Is there a PHP function for swapping the values of two variables?

前端 未结 19 917
终归单人心
终归单人心 2020-12-02 08:36

Say for instance I have ...

$var1 = \"ABC\"
$var2 = 123

and under certain conditions I want to sw

19条回答
  •  不思量自难忘°
    2020-12-02 09:09

    Here is another way without using a temp or a third variable.

    
    

    And if you want to make it a function:

        ';
        echo $b;
        ?>
    

提交回复
热议问题