|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2014-11-26 22:26 UTC] aharvey@php.net
[2017-08-04 23:21 UTC] stas@php.net
-Status: Open
+Status: Suspended
[2017-08-04 23:21 UTC] stas@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 08:00:01 2025 UTC |
Description: ------------ I'd like the ability to alias any variable when applied with the use operator. Currently, you must alias objects or array elements before the use operator, and pass the aliased value to the use operator. This could be simplified. Test script: --------------- <?php // Currently in PHP, you must alias before invoking the use operator. $sword = new stdClass(); $sword->length = 3; $length = $sword_length; function() use ($length) { // .. do something productive with $length. } // Using the as operator here seems more intuitive to the language's existing syntax. $sword = new stdClass(); $sword->length = 3; function() use ($sword->length as $length) { // .. do something productive with $length. }