
Code: Select all
<?php
$text = "ProductBrandType";
for ($i=0;$i<strlen($text);$i++){
if(ord($text[$i]) <=90 and ord($text[$i]) >= 60 and $i>0){
echo " ";
}
echo $text[$i];
}
?>
ord gets the ascii code of each letter from the string scanned by for, which is executed while $i value is less than the total size of the string $text.
If the ascii code is between 90 and 60 (the ascii code range for all uppercase letters) it prints an HTML space in the returnerd HTML code from the server to the user browser.
I hope it helped ;)