为什么array_push()不将pdo查询对象作为参数

Just curious. When pushing an array on another:

array_push($array_1, $array_2);

I get the usual behavior, but when I push a pdo query->fetchAll which contains and returns an array, nothing happens.

array_push($array_1, $query->fetchAll());

What is interesting to me is, if I assign the query object to a variable:

$array_fetchAll = $query->fetchAll();
array_push($array_1, $array_fetchAll);

It works like expected.

The only way this would work is using PHP version 5.5.X or above where a new feature allow functions to be dereferenced directly to access individual elements.

For example echo $stmt->fetchAll()[0]; would not work if you running PHP older than 5.5.x

array_push requires an array as parameter, if you are using older PHP you must store $query->fetchAll() into a variable.