Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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'));
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #key #array #element #php
ADD COMMENT
Topic
Name
4+3 =