日期:2014-05-17 浏览次数:20450 次
$a = "abcd"; $b = "1234"; echo "初始化时 a=$a,b=$b<br>"; $a = $a . $b; $b = strlen( $b ); $b = substr( $a, 0, (strlen($a) - $b ) ); $a = substr( $a, strlen($b) ); echo "交换后 a=$a,b=$b<br>";
------解决方案--------------------
php已经提供了绝好的途径
$a = "abcd";
$b = "1234";
list($b, $a) = array($a, $b);
echo "$a $b"; //1234 abcd