Hi, I need a little php code that can acheive this for example if i enter any keyword like $str="MyLapTop"; it should be converted to a php array like Array ( [0] => My,[1]=>Lap,[2]=>Top ) hope that make sense. Plz if anyone can help me. Thankx for reading this
hello, this function do what you want: <?php $str="MyLapTop"; $res = camelCaseToArray($str); echo "<pre>"; print_r($res); echo "</pre>"; function camelCaseToArray($text){ $text=preg_replace("/([A-Z])/","/#/$1",$text); return explode("/#/",(substr($text,0,3)=="/#/")?substr($text,3):$text); } PHP: output: Array ( [0] => My [1] => Lap [2] => Top ) Code (markup):