I have a predefined array $ar .
$num = count($ar) - 2;
print $ar[$num];
I always get an error when I'm trying to do an opertaion like this. I have also tried
print $ar[count($ar) - 2];
It gives me the same error yet again. I'm just frustrated.Tried so many ways.None of them work. How do i use mathematical symbols???!!
Thanks, Sai
EDIT:
Here is the code.
$linez = "http://directurl.com/image1.png
http://directurl.com/image2.png
";
$ar = explode("
",$linez);
$num = count($ar) - 1;
print $num;
It prints 2 instead of 1