insert into array
Moderator: General Moderators
- shiznatix
- DevNet Master
- Posts: 2745
- Joined: Tue Dec 28, 2004 5:57 pm
- Location: Tallinn, Estonia
- Contact:
insert into array
Ok i have to insert into a key and value into a array between 2 keys. i have keys 1 and 3 but after thats made i need to be able to insert a key 2 between the 2. when i do $arr['2'] = $some_var then it just inserts it after key 3 but i cant have that.
array_multisort works only for numeric keys.
Code: Select all
<?php
$arr = array();
$arr[0]="a";
$arr[2]="c";
$arr[1]="b";
array_multisort($arr);
while (list($k,$v)=each($arr))
{
echo $k.' : '.$v.'<br>';
}
?>