Answers for "array loop in php"

PHP
9

php foreach

<?php
$age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43");

foreach($age as $x => $val) {
  echo "$x = $val<br>";
}
?>
Posted by: Guest on April-07-2020
4

php for loop

for($i = 0; $i <=10; $i++){
	echo "The index is $i";
}
Posted by: Guest on July-23-2020
0

php loop through array

foreach($array as $item=>$values){
     echo $values->filepath;
    }
Posted by: Guest on July-12-2020

Browse Popular Code Answers by Language