I write custom explode function in PHP. It works fine for one character but how can modify this for multi character? if you change this code use only strlen() function.
function myExplode($delimiter,$str){
$arr=[];
$s="";
$count=0;
for ($i=0; $i < strlen($str); $i++) {
if ($str[$i]!=$delimiter) {
$s=$s.$str[$i];
if (!isset($str[$i+1])) {
$arr[$count]=$s;
$count++;
$s="";
}
}
else{
$arr[$count]=$s;
$count++;
$s="";
}
}
return $arr;
}
$hello="Hello World,this is me";
$explodedArr=myExplode("is",$hello);
print_r($explodedArr);