arrays - PHP Insert at particular index -


i want move element of array present @ 1st index 5th index in array. how can that?

if mean "move", can this

$from = 1; $to = 5; $el = $array[$from]; unset($array[$from]); $array = array_merge (     array_slice($array,0,$to),     array($el),     array_slice($array,$to)); 

cant test it, idea is: take , remove element @ $from original array, split rest @ $to , merge together. maybe index in array_slice() not match exactly;)


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -