Req #68510 [NEW]: Support aliasing with the use operator

From: Date: Wed, 26 Nov 2014 22:16:50 +0000
Subject: Req #68510 [NEW]: Support aliasing with the use operator
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188809@lists.php.net to get a copy of this message
From: eric dot lewis at nytimes dot com Operating system: CentOS PHP version: 5.6.3 Package: *General Issues Bug Type: Feature/Change Request Bug description:Support aliasing with the use operator 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. } -- Edit bug report at https://bugs.php.net/bug.php?id=68510&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68510&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68510&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68510&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=68510&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=68510&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=68510&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=68510&r=needscript Try newer version: https://bugs.php.net/fix.php?id=68510&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=68510&r=support Expected behavior: https://bugs.php.net/fix.php?id=68510&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=68510&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=68510&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=68510&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68510&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=68510&r=dst IIS Stability: https://bugs.php.net/fix.php?id=68510&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=68510&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=68510&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=68510&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=68510&r=mysqlcfg

« previous php.bugs (#188809) next »