|
|
Subscribe / Log in / New account

A PHP syntax for discardable assignments

A PHP syntax for discardable assignments

Posted Oct 15, 2020 8:35 UTC (Thu) by Rigrig (subscriber, #105346)
In reply to: A PHP syntax for discardable assignments by flewellyn
Parent article: A PHP syntax for discardable assignments

The first use that comes to mind is regular expression subpatterns:

preg_match('/(foo)(bar)(baz)/', 'foobarbaz', $matches);
[, $foo, $bar, $baz] = $matches; // $matches[0] = 'foobarbaz'


to post comments


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds