Home  >  Article  >  Backend Development  >  How to convert one-dimensional array to two-dimensional array in PHP_PHP tutorial

How to convert one-dimensional array to two-dimensional array in PHP_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:06:141259browse

How to convert a one-dimensional array to a two-dimensional array in PHP

This article mainly introduces the method of converting a one-dimensional array to a two-dimensional array in PHP and analyzes the PHP operation array with examples. The skills have certain reference value. Friends in need can refer to it

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:

1

2

3

4

5

6

7

8

9

10

11

$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);

?>

1 2

3

4 5

67 8 9 10 11
$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. http://www.bkjia.com/PHPjc/960582.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/960582.htmlTechArticleHow to convert one-dimensional array to two-dimensional array in PHP. This article mainly introduces how to convert one-dimensional array to two-dimensional array in PHP. Dimensional array method, example analysis of PHP array manipulation skills, with certain reference...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn