convert string to lowercase in php
/* strtolower() function converts string to lowercase. */
<?php
echo strtolower("Hello WORLD 123");
?>
// Output:hello world 123
convert string to lowercase in php
/* strtolower() function converts string to lowercase. */
<?php
echo strtolower("Hello WORLD 123");
?>
// Output:hello world 123
convert string to lowercase in php
/* The strtolower() function converts a string to lowercase.
Convert all characters to lowercase.*/
<?php
echo strtolower("Hello WORLD.");
?>
// Output: hello world.
string to lowercase accentuation hyphenated
<?php
/**
* Converts string to SEO-friendly form (lowercase hyphenated alphanumeric words)
*
* @param $string
* @return string
*/
function seoUrl($string)
{
// qv stackoverflow.com/questions/11330480, stackoverflow.com/questions/1017599
$src = 'àáâãäçèéêëìíîïñòóôõöøùúûüýÿßÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝ';
$rep = 'aaaaaceeeeiiiinoooooouuuuyysAAAAACEEEEIIIINOOOOOOUUUUY';
// strip off accents (assuming utf8 PHP - note strtr() requires single-byte)
$string = strtr(utf8_decode($string), utf8_decode($src), $rep);
// convert to lower case
$string = strtolower($string);
// strip all but alphanumeric, whitespace, dot, underscore, hyphen
$string = preg_replace("/[^a-z0-9\s._-]/", "", $string);
// merge multiple consecutive whitespaces, dots, underscores, hyphens
$string = preg_replace("/[\s._-]+/", " ", $string);
// convert whitespaces to hyphens
$string = preg_replace("/[\s]/", "-", $string);
return $string;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us