how to traverse characters in a string in a for loop in php

111

<?php
$str = "apple";
 
$length = strlen($str);
for ($index = 0; $index < $length; $index++) {
    echo $str[$index];
    echo "<br>";
}
?>

Comments

Submit
0 Comments