In python I would do this:
var = ["test","test1","test2","test3"];
test= var[1:3];
Then variable 'test' would be ["test1","test2","test3"]
How can I do this in PHP?
That would be array_slice($var, 1, 3)
. See also: http://php.net/manual/en/function.array-slice.php.
Complete example:
$var = array("test","test1","test2","test3");
$test = array_slice($var, 1, 3);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With