3
So I was browsing php.net when I came across List() and went to see what it was for. Then they gave me the following example:
$info = array('Café', 'marrom', 'cafeína');
list($bebida, $cor, $substancia) = $info;
echo "$bebida é $cor e $substancia o faz especial.\n";
On that one I ask myself, Can’t I, instead of doing this, be like,:
$info = [$bebida, $cor, $substancia];
aí fazer tipo
$info[0] = "café"
$info[1] = "marrom"
$info[2] = "cafeína"
And then just call on one echo
of life-type "$info[0] é $info[1] e $info[2] o faz especial. \n"
??
That’s exactly what I’m studying. I realized there are many ways to do various things in php. But I’m still starting and I’m trying to differentiate situations and know at what point I use such code. Thank you for the support!
– kali