Coming from a javascript background, I'm having a little difficulty inserting a php array into another array.
If I have the following:
$common_properties = array(
'foo' => 'bar',
'eats' => array(
'apples' => true,
'oranges' => true
)
);
$one = array(
'name' => 'one',
'desc' => 'Lorem'
);
$two = array(
'name' => 'two',
'desc' => 'Ipsum'
);
How can I make the $common_properties array accessible from $one and $two? I need to pass the resulting array(s) as arguments to a function. For some reason, array_merge resulted in an error.
The desired result should be, for example:
$one = array(
'name' => 'one',
'desc' => 'Lorem'
'foo' => 'bar',
'eats' => array(
'apples' => true,
'oranges' => true
)
);
array_merge()resulted into an error, i think you can just straight up merge them using that function