we have an array which looks something like this
<?php
$list = array(
'liquid'=>array('water','soft drink'),
'solid'=>array('car','computer','floor'),
'gas'=>array('air','oxygen','carbon dioxide'),
);
?>
now this is just an example list, what we are trying to achieve is
a user passes a value in a function like this
<?php
function return_state($matter_value){
return array_search($matter_value, $list);
}
?>
- user passes
waterthe result should be liquid - user passes
floorthe result should be solid
in short whatever user is passing it will return the key associated with it
but when we are executing this function, it returns ''(empty value).
What are we doing wrong ?