I would like to create a PHP array, where some of the elements are to be replaced by elements of an array returned by a function. As example, I would like to create the following array:
$aArray = array(
0x01,
0x10,
foo(1234),
0x03,
foo(445),
...
)
Here, foo
is a function returning a simple PHP array. What I get is, of course, something like
(
[0] => 1
[1] => 16
[2] => Array
(
[1] => 2
[2] => 4
)
[3] => 03
[4] => Array
....
But what I actually want to do is to include the returned values from the function directly into the array, to create something like: ( [0] => 1 [1] => 16 [2] => 2 [3] => 4 [4] => 03 [5] => 3 ....
Is this possible to do in a simple way, without having to construct the array with array_merge
?
P.S: The above example is not a working example, just showing what I want to do. The content of the function foo
is also irrelevant.