xxxxxxxxxx
$userdb=Array
(
(0) => Array
(
(uid) => '100',
(name) => 'Sandra Shush',
(url) => 'urlof100'
),
(1) => Array
(
(uid) => '5465',
(name) => 'Stefanie Mcmohn',
(pic_square) => 'urlof100'
),
(2) => Array
(
(uid) => '40489',
(name) => 'Michael',
(pic_square) => 'urlof40489'
)
);
$key = array_search(40489, array_column($userdb, 'uid'));
xxxxxxxxxx
<?php
$user_array = array(
0 => array(
"name" => "kumar Sai",
"username" => "kskumar",
"id" => 1011
),
1 => array(
"name" => "badri",
"username" => "badrikumar",
"id" => 1012
),
2 => array(
"name" => "suresh",
"username" => "skumar",
"id" => 1013
)
);
if (array_search(1012, array_column($user_array, 'id')) !== FALSE)
echo 'User Available';
else
echo 'User Not Available';
?>
xxxxxxxxxx
// 1d array
in_array('something', $array);
// 2d array
array_column($multi_array, 'your_column');
/**
0 => ['hi'=>0, 'your_column'=>1, 'hi'=>0, 'your_column'=>3]
will be
[1, 3]
and then you can apply the in_array function on that new array ^
*/