|  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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
26 - 10 = ?
Subscribe to this entry?

 [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: Sat Feb 04 03:03:45 2023 UTC