function take()
{
$array = [1, 2, 3];
return array_slice($array, 2);
}
So this function returns with an array containing 3, but i'd like to return with an array containing 1 and 2, is this possible somehow?
function take()
{
$array = [1, 2, 3];
return array_slice($array, 2);
}
So this function returns with an array containing 3, but i'd like to return with an array containing 1 and 2, is this possible somehow?
If you want to return the the remaining part of the array, use array_diff
.
function take()
{
$array = [1, 2, 3];
return array_diff ($array, array_slice($array, 2));
}