3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?phpfunction mbStringToArray ($string) { $strlen = mb_strlen($string); while ($strlen) { $array[] = mb_substr($string,0,1,"UTF-8"); $string = mb_substr($string,1,$strlen,"UTF-8"); $strlen = mb_strlen($string); } return $array;}function joinsigns($array){ $singsArray=array("ि","्"); $out=array($array[0]); for ($i=1; $i <count($array) ; $i++) { if (in_array($array[$i], $singsArray)) { $out[count($out)-1].=$array[$i]; }else{ $out[]=$array[$i]; } } return $out;}$a = "बिक्रम";$ar=mbStringToArray($a);print_r($ar);echo "<br>";print_r(joinsigns($ar));
Output for 5.4.34
Parse error: syntax error, unexpected 'mbStringToArray' (T_STRING) in /in/i1OCQ on line 1
Process exited with code 255.
Output for 5.4.0 - 5.4.32
<?phpfunction mbStringToArray ($string) { $strlen = mb_strlen($string); while ($strlen) { $array[] = mb_substr($string,0,1,"UTF-8"); $string = mb_substr($string,1,$strlen,"UTF-8"); $strlen = mb_strlen($string); } return $array;}function joinsigns($array){ $singsArray=array("ि","्"); $out=array($array[0]); for ($i=1; $i <count($array) ; $i++) { if (in_array($array[$i], $singsArray)) { $out[count($out)-1].=$array[$i]; }else{ $out[]=$array[$i]; } } return $out;}$a = "बिक्रम";$ar=mbStringToArray($a);print_r($ar);echo "<br>";print_r(joinsigns($ar));