Parallel array assignment in PHP -
Most languages have made it easy to get an array like [1, 2, 3]
For those values, with variables from a
, b
, and c
with the same command. For example, in Perl you can
($ a, $ b, $ c) = (1, 2, 3);
What is the related move in PHP?
[Thanks for the quick answer of lightning! I know that this is a trivial question but all the obvious Google questions have not answered, so it's my endeavor to decide.]
Use:
list ($ a, $ b, $ c) = $ someArray;
Comments
Post a Comment