How does PHP's list function work?
- by Jacob Relkin
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?