Answers for "how to print key/pair in 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
1

get key of array element php

$people = array(
  2 => array(
    'name' => 'John',
    'fav_color' => 'green'
  ),
  5=> array(
    'name' => 'Samuel',
    'fav_color' => 'blue'
  ));
$found_key = array_search('blue', array_column($people, 'fav_color'));
Posted by: Guest on May-18-2020

Code answers related to "how to print key/pair in php"

Browse Popular Code Answers by Language