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
Post a Comment