Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

PHP multidimensional array search by value

<?php
// PHP program to carry out multidimensional array search
  
  
// Multidimensional array
$gfg_array = array(
    array(
        'score'   => '100',
        'name'    => 'Sam',
        'subject' => 'Data Structures'
    ),
    array(
        'score'   => '50',
        'name'    => 'Tanya',
        'subject' => 'Advanced Algorithms'
    ),
    array(
        'score'   => '75',
        'name'    => 'Jack',
        'subject' => 'Distributed Computing'
    )
);
  
$id = array_search('50', array_column($gfg_array, 'score'));
echo $id;
  
?>
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #PHP #multidimensional #array #search
ADD COMMENT
Topic
Name
4+1 =