I am newbie programmer of php. How should I create array without specifying the size of array.I have tried using
$items = array();
How can add array as the element? Without having to specify the index. Thanks in advance for any feedback.
// define array
$item = array();
// adding multi dimensional array
array_push($item, array('name'=>'Pen','qty'=>1));
You may nest the array to even more levels by same method as mentioned above.
$items[] = 'my new item';
check the php manual
creating mutlidimesional array in php is easy stuff
<?php
$shop = array( array("rose", 1.25 , 15),
array("daisy", 0.75 , 25),
array("orchid", 1.15 , 7)
);
?>