简体   繁体   中英

PHP Push into array multidimensional

I'm trying to push some data into a multidimensional array, but can't find the correct syntax anywhere.

array_push($price, $row["ShopID"], $row["URL"]);

This is my code so far, but this does not make the array multidimensional, it just inserts each item as an individual row in the array. How can I fix this, and make the array multidimensional?

Are you pushing an array? Then:

array_push($price, array($row["ShopID"], $row["URL"]));

or maybe:

 array_push($price, $row);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM