Remove all elements before x from an array php -


if give you:

$array = array(object1, object2, object3, object4); 

and say, @ position 2, remove elements before position end result is:

$array = array(object3, object4); 

what do? looking @ array_shift , array_splice achieve wanted - how ever not sure use or how use them achieve desired affect.

use array_slice. more detail check link http://php.net/manual/en/function.array-slice.php

$array = array(object1, object2, object3, object4); $array = array_slice($array,2); // 2 position 

Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -