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

前端 未结 19 857
终归单人心
终归单人心 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
    $a = 'ravi';
    
    $b = 'bhavin';
    
    $a = $b.$a;
    
    $b = substr($a,strlen($b),strlen($a));
    
    $a = substr($a,0,strlen($a)-strlen($b));
    
    echo "a=".$a.'<br/>'.'b='.$b;
    
    0 讨论(0)
提交回复
热议问题