Answers for "foreach array print php"

PHP
1

loop through values of hash php

foreach ($array as $key => $val) {
    print "$key = $val\n";
}
Posted by: Guest on February-16-2020
1

php foreach array

$arr = array(1, 2, 3);
foreach ($arr as $key => $value) {
    echo "{$key} => {$value} ";
}
Posted by: Guest on March-06-2021
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
1

php ofreach

<?php

$a = array(1, 2, 3, 17);

foreach ($a as $index => $v) {
    echo "Current value of \$a: $v.\n";
}

?>
Posted by: Guest on April-23-2020

Browse Popular Code Answers by Language