<?php
$a = "Hello World I am Neha Singh Chouhan";
$length = 0;
do {
$length++;
}
while ($a[$length] != null);
echo "Length = ".$length."<br/>";
for ($i = $length - 1; $i >= 0; $i--) {
echo $a[$i];
}
?>
tried to calculate the string length without using inbuilt function strlen().
the output was
Notice: Uninitialized string offset: 35 in C:\xampp\htdocs\Neha\ProgramsFromClass\10_reverse_string.php on line 7
Length = 35 nahuohC hgniS aheN ma I dlroW olleH
What causes the notice and how can i get rid of it?