Answers for "php array get values by key"

PHP
3

php count array elements with specific key

$cnt = count(array_filter($array,function($element) {
  return $element['your_key']=='foo';
}));
Posted by: Guest on July-13-2020
0

php array access by key

$newarray = array();
foreach($shop as $key=>$value) {
    $newarray[$key]['Title'] = $value['Title'];
    $newarray[$key]['Number'] = $value['Number'];
}
echo "<pre>";print_r($newarray);
Posted by: Guest on April-30-2021

Code answers related to "php array get values by key"

Browse Popular Code Answers by Language