Answers for "key value in foreach php"

PHP
3

foreach in php

<?php
// Declare an array 
$arr = array("green", "blue", "pink", "white");  
  
// Loop through the array elements 
foreach ($arr as $element) { 
    echo "$element "; 
} 
?>
Posted by: Guest on July-09-2020
0

loop through values of hash php

<?php
    while (list($var, $val) = each($array)) {
        print "$var is $val\n";
    }
?>
Posted by: Guest on February-16-2020

Browse Popular Code Answers by Language