Adding elements to the beginning of a multidimensional array and pushing the other elements to the next row PHP -


i'm trying add elements multidimensional array, want push other elements next row when that, right i'm able have them on same row. please take look:

$array[0][0] = "one"; $array[0][1] = "two"; $array[1][0] = "three"; $array[1][1] = "four";  et($array); <--- function echo array in table format 

output:

|one   |two |  |three |four| 

adding element beginning of array, , echoing out:

array_unshift($array[0] , 'zero'); et($array); 

output:

|zero  |one |two|  |three |four|   | 

the output i'm trying get:

|zero |    |  |one  |two |   |three|four|   

is there way element added first row, , push other elements second row in multidimensional array? if there is, please let me know. thank you.

you need prepend new array onto existing array:

array_unshift($array, array('zero')); 

or depending on et() function expects:

array_unshift($array, array('zero', '')); 

or maybe need &nbsp; render cell correctly. not sure without code.


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -