";
}
function textToUrl($text)
{
// Convert the text to lowercase
$text = strtolower($text);
// Replace spaces and underscores with a dash
$text = preg_replace('/[\s_]+/', '-', $text);
// Remove all characters that are not alphanumeric, dashes, or dots
$text = preg_replace('/[^a-z0-9\-\.]/', '', $text);
// Optionally, you can trim dashes from the beginning and end
$text = trim($text, '-');
// Return the URL-friendly string
return $text;
}
// http://localhost/ecom_demo/
// http://localhost/navpraanayurveda/
function getProduct($data)
{
$url = "product-detail.php?url={$data[2]}-{$data[0]}";
$image = "media/image/thumb/{$data[6]}";
$rand = rand(10, 200);
echo "
*/
function generateUniqueCode($length = 8)
{
// Define the characters you want to include in the code
$characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
$charactersLength = strlen($characters);
$uniqueCode = '';
// Generate a random string of the specified length
for ($i = 0; $i < $length; $i++) {
$uniqueCode .= $characters[rand(0, $charactersLength - 1)];
}
return $uniqueCode;
}