How does PHP's list function work?
Posted
by
Jacob Relkin
on Stack Overflow
See other posts from Stack Overflow
or by Jacob Relkin
Published on 2010-09-22T05:40:51Z
Indexed on
2011/01/02
4:53 UTC
Read the original article
Hit count: 250
After recently answering a couple of questions here on SO that involved utilizing PHP's list
function, I wondered, "how in the world does that function actually work under the hood?". I was thinking about something like using func_get_args()
and then iterating through the argument list, and that's all nice and peachy, but then how in the world does the assignment part work?
list(...) = array($x, $y, $z);
isn't this ^ evaluated first?
So to be precise, my question is how is the list
function able to create scoped variables which get assigned to the not-yet evaluated array?
© Stack Overflow or respective owner