Skip to content

Instantly share code, notes, and snippets.

View PYovchevski's full-sized avatar

Petko Yovchevski PYovchevski

View GitHub Profile
@PYovchevski
PYovchevski / gist:b944d9e596b3acb9d02e03229f36569a
Created June 17, 2018 14:12 — forked from dalethedeveloper/gist:966848
Reorder a PHP array, moving items up or down
<?php
/*
A quick set of functions to move items in a non-associative array
up or down by one, shifting the items around it appropriately.
Original usage was to for a set of UP and DOWN buttons to
manipulate the order of an array of items stored in Wordpress option.
*/
$a = array('a','b','c','d','e');