3
I got the following array
$array = [25, 'Wallace', '26 anos', 'linguagens' => ['PHP', 'Python', 'C#']
I’d like to use the function list
to be able to capture some elements directly into variables, more or less like this:
list($id, $nome, $idade) = $array;
But I would like to ignore the first element (which would be the variable $id
), leaving only the following variables: $nome
and $idade
.
Is there any way to "jump" an element of array
when creating variables with list
?
I don’t want to have to do this:
list($id, $nome, $idade) = $array;
unset($id);
And if I wanted to skip two elements of array
? would have to give unset
in all first variables?
Next question, how to skip element 2 and 5 :D
– Guilherme Lautert