I know how to insert it to the end by:
$arr[] = $item;
But how to insert it to the beginning?
Use array_unshift($array, $item);
$arr = array('item2', 'item3', 'item4'); array_unshift($arr , 'item1'); print_r($arr);
will give you
Array ( [0] => item1 [1] => item2 [2] => item3 [3] => item4 )
1.4m articles
1.4m replys
5 comments
57.0k users