|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
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-2023 The PHP Group
All rights reserved.
Last updated: Fri Jan 27 15:03:46 2023 UTC