Req #70736 [Com]: Support to swap() function
| From: | marcio@php.net | Date: | Wed, 28 Oct 2015 04:51:26 +0000 |
| Subject: | Req #70736 [Com]: Support to swap() function | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-196850@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: marcio@php.net
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:
What's the problem with
list($a, $b) = [$b, $a]; ?
Previous Comments:
------------------------------------------------------------------------
[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