php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #70736 Support to swap() function
Submitted: 2015-10-19 04:12 UTC Modified: 2018-06-24 04:22 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: david dot proweb at gmail dot com Assigned: cmb (profile)
Status: No Feedback Package: Scripting Engine problem
PHP Version: Next Major Version OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2015-10-19 04:12 UTC] 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.


Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-10-19 07:07 UTC] stas@php.net
-Package: PHP Language Specification +Package: Scripting Engine problem
 [2015-10-28 04:51 UTC] marcio@php.net
What's the problem with `list($a, $b) = [$b, $a];` ?
 [2015-10-28 04:51 UTC] mail at jerrygrey dot me
Pull request: https://github.com/php/php-src/pull/1609
 [2018-06-16 13:46 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2018-06-16 13:46 UTC] cmb@php.net
> What's the problem with `list($a, $b) = [$b, $a];` ?

Good question!
 [2018-06-24 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Dec 09 01:05:53 2022 UTC