I have this array
$arr= [
0 => "T"
1 => "h"
2 => "e"
3 => " "
4 => "w"
5 => "r"
6 => "i"
7 => "t"
8 => "e"
9 => "r"
10 => ""
11 => " "
12 => "w"
13 => "a"
14 => "s"
15 => " "
..
..
for($j=0;$j<count($arr);$j++)
{
if($arr[$j-1]==" ")
{
}
}
In this if condition if($arr[$j-1]==" ")
getting this error
message: "Undefined offset: -1", exception: "ErrorException
the previous key exists but i'm still getting error
Any solution to fix this issue