Why this php error Notice: Undefined offset: 58
Skip that error when using the following function, more specifically on the line marked with the comment.
<?php
public function repeatLine($string){
$array = str_split($string);
for($i=0;$i<count($array);$i++){
if($array[$i] == "-" && $array[$i+1] == "-"){ ///////Acá salta el error!
$array[$i+1] = "";
}
}
return $array;
}
?>