I have the following array
$array = [25, 'Wallace', '26 anos', 'linguagens' => ['PHP', 'Python', 'C#']
I would like to use the list
function to capture some elements directly in variables, like this:
list($id, $nome, $idade) = $array;
But I'd like to ignore the first element (which would be the $id
variable), leaving only the following variables: $nome
and $idade
.
Is there any way to "skip" an element of array
when creating variables with list
?
I do not want to have to do this:
list($id, $nome, $idade) = $array;
unset($id);
What if I wanted to skip 2 elements of array
? would you give unset
on all the first variables?