untuk loop php
<?php
$fruits = ["apple", "banana", "orange"];
for($i=0;$i<count($fruits);$i++){
echo "Index of ".$i."= ".$fruits[$i]."<br>";
}
?>
SISO
<?php
$fruits = ["apple", "banana", "orange"];
for($i=0;$i<count($fruits);$i++){
echo "Index of ".$i."= ".$fruits[$i]."<br>";
}
?>
for($i = 0;$i < count($users);$i++) {
if($users[$i]['user_id']==3){
$userName = $users[$i]['first_name'];
}
}
<?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>";
}
?>
for($i = 1; $i > 10; $i++){
//show i value
echo "Your Number Is :$i";
}
/*teting*/