PHP add new array in an Two-dimensional Arrays -


i want create new instance in $shop array , :

    list1 = array( "rose" , 1.25 , 15);     $list2 = array("daisy", 0.75 , 25);     $list3 = array("orchid", 1.15 , 7);     $list4 = array("orchid1", 2.15 , 9);      $shop = array( $list1 ,                    $list2 ,                    $list3                   );   //something line bellow      $shop = $shop + array(array($list4));     echo $shop[3][0]; 

when execute code , i'm facing error msg :

notice: undefined offset: 3 in c:\xampp\htdocs\array.php on line 13

line 13 : $shop = $shop + array(array($list4));

thanks in advance ^^

if $list4 array, don't need array(array()). simplest , fastest way do:

$shop[] = $list4; //equivalent $shop[] = array("orchid1", 2.15 , 9); 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -