Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

How to write a loop in PHP

<?php

//FOR each item within the array, "ECHO" out the index ($i) and value of each item.
$numbersArray = [1, 2, 3]
for($i = 0; $i < count($numbersArray); $i++) {
	echo "Index of ".$i."= ".$numbersArray[$i]."<br>";
}

?>
 
PREVIOUS NEXT
Tagged: #How #write #loop #PHP
ADD COMMENT
Topic
Name
6+7 =