Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * ArrayHelper
- *
- * @author Ali Irani <ali@irani.im>
- */
- class ArrayHelper
- {
- /**
- * Move an array item from an index to another index position
- * @param array $array
- * @param int $from
- * @param int $to
- *
- * @return array
- */
- public static function moveItem($array, $from, $to)
- {
- $item = array_splice($array, $from, 1);
- array_splice($array, $to, 0, $item);
- return $array;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement