Req #70736 [Com]: Support to swap() function
| From: | mail at jerrygrey dot me | Date: | Wed, 28 Oct 2015 04:51:44 +0000 |
| Subject: | Req #70736 [Com]: Support to swap() function | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-196851@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70736&edit=1
ID: 70736
Comment by: mail at jerrygrey dot me
Reported by: david dot proweb at gmail dot com
Summary: Support to swap() function
Status: Open
Type: Feature/Change Request
Package: Scripting Engine problem
PHP Version: Next Major Version
Block user comment: N
Private report: N
New Comment:
Pull request: https://github.com/php/php-src/pull/1609
Previous Comments:
------------------------------------------------------------------------
[2015-10-28 04:51:25] marcio@php.net
What's the problem with
list($a, $b) = [$b, $a]; ?
------------------------------------------------------------------------
[2015-10-19 04:12:06] david dot proweb at gmail dot com
Description:
------------
This function should swap two variables. Currently it can be done by code a swap function, like:
function swap(&$a, &$b) {
$tmp = $a;
$a = $b;
$b = $tmp;
}
I think that should be useful PHP do it alone, and simple to include it on code.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70736&edit=1