Advertisement
Guest User

Untitled

a guest
Dec 9th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. <?php
  2. /**
  3. * ArrayHelper
  4. *
  5. * @author Ali Irani <ali@irani.im>
  6. */
  7. class ArrayHelper
  8. {
  9. /**
  10. * Move an array item from an index to another index position
  11. * @param array $array
  12. * @param int $from
  13. * @param int $to
  14. *
  15. * @return array
  16. */
  17. public static function moveItem($array, $from, $to)
  18. {
  19. $item = array_splice($array, $from, 1);
  20. array_splice($array, $to, 0, $item);
  21.  
  22. return $array;
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement