extracting information from array
Posted: Tue Jan 06, 2009 3:45 am
Hi all I was wondering if it is possible to extract the entire key of an array and storing it in a variable.
My array contains strings:
$arr[0] = I am a boy
$arr[1] = I am a girl
$arr[2] = I am a mom
Is it possible to search through the entire array for the element by just typing in a keyword for example "boy"?
my code currently goes like this:
$search = array_search("boy", $arr);
$who = explode(" ", $search);
$captured = $who[3];
Hope you guys can help me with it because it does not work currently.
My array contains strings:
$arr[0] = I am a boy
$arr[1] = I am a girl
$arr[2] = I am a mom
Is it possible to search through the entire array for the element by just typing in a keyword for example "boy"?
my code currently goes like this:
$search = array_search("boy", $arr);
$who = explode(" ", $search);
$captured = $who[3];
Hope you guys can help me with it because it does not work currently.