Answers for "php for loop example"

PHP
27

for loop php

<?php
	$fruits = ["apple", "banana", "orange"];
	for($i=0;$i<count($fruits);$i++){
    echo "Index of ".$i."= ".$fruits[$i]."<br>";
    }
  ?>
Posted by: Guest on December-28-2019
4

for loop in php

for($i = 0;$i < count($users);$i++) {

    if($users[$i]['user_id']==3){

        $userName = $users[$i]['first_name'];

    }

}
Posted by: Guest on January-08-2022
0

PHP for Loop

<?php
for ($x = 0; $x <= 10; $x++) {
  echo "The number is: $x <br>";
}
?>
Posted by: Guest on May-23-2022

Browse Popular Code Answers by Language