I have 2 dimensions, such row=6 and col=5. The size can change.
How can I create an 2D empty array. Following approach is NOT what I am looking for, because it does not contains anything.
$arr = array(array());
How can I create an 2d array with dynamic size of "" values.
Many Thanks, BM
This is how you can create a 2d array with a dynamic size
$array = array();
foreach ($rows as $row){
$array_values = array();
// Add as much values you want to add
array_push($array_values, '1');
array_push($array_values, '2');
array_push($array, $array_values);
}
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.