I'm a little bit starting with php
this and I was wondering if it's possible to combine two arrays
, more or less my idea is this:
$fruits = array("id"=>"1", "name"=>"banana");
$vegetables = array("id"=>"1", "name"=>"cabbage");
foreach($fruits as $fruit)
{
$results = array("id"=>$fruit->id, "description"=>$fruit->name);
}
// $results = array("id"=>" ", "description"=>" ");
return $results;
I want to know if I can return, those two array
within a single one, with those two keys " id
" and " description
", is there any method to do it? I tried with array_fill_keys
but it did not work. thanks.