method move documentation in bbn\X

Moves an index in the given array to a new index.

Example

$arr = [ ['a' => 1, 'b' => 2], ['c' => 3, 'd' => 4], ['e' => 5, 'f' => 6] ]; X::move($arr, 0, 2); // (array) [ // ['c' => 3, 'd' => 4], // ['e' => 5, 'f' => 6], // ['a' => 1, 'b' => 2] // ] function(array &$ar, int $old_index, int $new_index) { $out = array_splice($ar, $old_index, 1); array_splice($ar, $new_index, 0, $out); }

Moves an index in the given array to a new index. BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.