<?php
$a = "a";
$b = "b";
// 拼接
$a .= $b;
// 截取
$b = substr($a, 0, (strlen($a) - strlen($b)));
$a = substr($a, strlen($b));
echo "<hr/>";
// str_replace
// str_replace($search, $replace, $subject)
$b = str_replace($b, "", $a);
$a = str_replace($b, "", $a);
echo "<hr/>";
// list & array
list($b, $a) = array($a, $b);
echo "<hr/>"
// 异或运算-字符串数字合适使用
$a = $a ^ $b;
$b = $b ^ $a;
$a = $a ^ $b;
// 数字
$a = 3;
$b = 5;
$a = $a + $b;
$b = $a - $b;
$a = $a - $b;
网友评论