the for statement can intialize a counter php code example
Example 1: for loop php
<?php
$fruits = ["apple", "banana", "orange"];
for($i=0;$i<count($fruits);$i++){
echo "Index of ".$i."= ".$fruits[$i]."<br>";
}
?>
Example 2: $s = [1,2,3] for loop use in php
$x = [1,2,3]