<?php
    $a = 'a';
    $b = 'b';
    //第一种方法 字符串截取
    $a .= $b;
    $b = substr($a,0,strlen($a)-strlen($b));
    $a = substr($a,strlen($a)-strlen($b));

    echo $a;
    echo "<br>";
    echo $b;
    echo "<br>";

    //第二种方法 字符串替换
    $a .=$b;
    $b = str_replace($b,"",$a);
    $a = str_replace($b,"",$a);
    echo $a;
    echo "<br>";
    echo $b;
    echo "<br>";

    //第三种方法 数组转换
    list($b,$a) = array($a,$b);
    echo $a;
    echo "<br>";
    echo $b;
    echo "<br>";

    //第四种方法 异或运算
    $a=$a^$b;
    $b=$b^$a;
    $a=$a^$b;
    echo $a;
    echo "<br>";
    echo $b;