Answers for "how to foreach loop key and value php"

PHP
5

php foreach echo key value

foreach($page as $key => $value) {
  echo "$key is at $value";
}
Posted by: Guest on September-04-2020
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

Code answers related to "how to foreach loop key and value php"

Browse Popular Code Answers by Language