Home > Article > Backend Development > How to convert one-dimensional array to two-dimensional array in PHP, php dimensional array to two-dimensional array_PHP tutorial
The example in this article describes the method of converting a one-dimensional array to a two-dimensional array in PHP. Share it with everyone for your reference. The specific implementation method is as follows:
<?php $asr[1] = array("a","b","c","d"); $asr[2] = array("a","b","c","d"); $asr[3] = array("a","b","c","d"); $newarray = array(); foreach($asr as $a) { $newarray[] = $a; } print_r($newarray); ?>
I hope this article will be helpful to everyone’s PHP programming design.