|  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
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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: david dot proweb at gmail dot com
New email:
PHP Version: OS:


 [2015-10-19 04:12 UTC] david dot proweb at gmail dot com
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.


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-10-19 07:07 UTC]
-Package: PHP Language Specification +Package: Scripting Engine problem
 [2015-10-28 04:51 UTC]
What's the problem with `list($a, $b) = [$b, $a];` ?
 [2015-10-28 04:51 UTC] mail at jerrygrey dot me
Pull request:
 [2018-06-16 13:46 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2018-06-16 13:46 UTC]
> 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: Sat Nov 26 21:05:52 2022 UTC