i have following function where i have brands info in an array. i should get array containing those info when i pass brand name to this function.
function brand_info($brand)
{
$brands_list=array (
'lg'=>
array(
'name' => 'LG Phone Company',
'country' => 'country',
'founded_year' => '2001'
),
'nokia'=>
array(
'name' => 'Nokia Phone Company',
'country' => 'country',
'founded_year' => '2001'
)
);
if(in_array($brand,$brands_list))
{
// return array containg company info
}
}
this should return an array by which i can show these info.
$brand_info=brand_info($brand_name);
echo $brand_info['name'];
what may be the best way to do this?
If you’re passing in the brandname then this would suffice: