3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function 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));
based on i1OCQ
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [0] => ब [1] => ि [2] => क [3] => ् [4] => र [5] => म ) <br>Array ( [0] => बि [1] => क् [2] => र [3] => म )