3v4l.org

run code in 200+ 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 HeTnL
Output for 4.3.0 - 7.2.0
Array ( [0] => म [1] => ा [2] => य [3] => न [4] => े ) <br>Array ( [0] => मा [1] => य [2] => ने )