I created this working code using array_merge in php.
getData() is returning an array.
$cars = array();
$cars = array_merge($cars, $this->getData($x, $y, $z, 0, -1));
$cars = array_merge($cars, $this->getData($x, $y, $z, 1, -1));
$cars = array_merge($cars, $this->getData($x, $y, $z, 1, 0));
$cars = array_merge($cars, $this->getData($x, $y, $z, 1, 1));
There is a better way to do the same?
getData()return indexed data or associative data? We don't have a minimal reproducible example, so we can't confidently give appropriate advice.