I cannot for the life of me figure out how to search through a multidimensional array for a key => value pair, and then either A) Return the array it belongs to or a different specific key => value pair that exists in the same array.
My array is:
$pages = array(
array(
'pageId' => 10,
'title' => 'Welcome',
'theme' => 'basic'
),
array(
'pageId' => 11,
'title' => 'Home',
'theme' => 'basic'
),
array(
'pageId' => 12,
'title' => 'Login',
'theme' => 'basic'
)
);
I've tried
$theme = array_search(10, array_column($search, 'pageId'));
but it keeps returning an int and not the value basic as I am wanting.
I would like either just the value or an array with the key => value pair or the whole array it belongs to.
'theme' => 'basic'? Do you wantbasicwhich is the value of theme?