时间:2021-07-01 10:21:17 帮助过:15人阅读
$a = "abcd"; $b = "1234"; echo "初始化时 a=$a,b=$b
"; $a = $a . $b; $b = strlen( $b ); $b = substr( $a, 0, (strlen($a) - $b ) ); $a = substr( $a, strlen($b) ); echo "交换后 a=$a,b=$b
";
------解决方案--------------------
php已经提供了绝好的途径
$a = "abcd";
$b = "1234";
list($b, $a) = array($a, $b);
echo "$a $b"; //1234 abcd