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
)
More Related Contents:
- how can I print multiple services in this way
- Prevent creating duplicate entries in PHP
- Display multidimensional array in php
- Remove Duplicates in array php
- Convert php array to Javascript
- PHP Sort a multidimensional array by element containing Y-m-d H:i:s date
- How to push both value and key into PHP array
- How to bind mysqli bind_param arguments dynamically in PHP?
- How to check whether an array is empty using PHP?
- php multi-dimensional array remove duplicate [duplicate]
- How is the PHP array implemented on the C level?
- Convert array of single-element arrays to one a dimensional array
- PHP – Merging two arrays into one array (also Remove Duplicates)
- Convert flat array to a delimited string to be saved in the database
- Transpose 2d array, join second level with commas, and join first level with pipes
- PHP Objects vs Arrays — Performance comparison while iterating
- Merge two arrays containing objects and remove duplicate values
- Looping a multidimensional array in php
- How get value for unchecked checkbox in checkbox elements when form posted?
- Deep recursive array of directory structure in PHP
- why is $_REQUEST empty
- Using value of a column as index in results using PDO
- Keep Duplicates while Using array_diff
- Re-index numeric array keys [duplicate]
- Reverse array in php
- PHP – count specific array values
- Sort an array of associative arrays by column value
- Insert elements from one array (one-at-a-time) after every second element of another array (un-even zippering)
- How does array_diff work?
- How to remove values from two arrays that have the same key and value?