民审-M

Discuz!插件应用PHP运算符逻辑判断序列化混淆

作者:民审-M   发布时间:2018-01-30 13:12   回复数:0   浏览数:280
民审-M
2800民审-M金牌草根
2018-01-30 13:12:00
2800 2018-01-30 13:12:00
[color=rgb(0, 0, 0)][backcolor=rgb(253, 252, 248)][p=21, null, left]本节展示了可用于 PHP 脚本中的各种运算符.[/p]
[color=rgb(0, 0, 0)][backcolor=rgb(253, 252, 248)]PHP 算数运算符[table=100%,#ffffff,#dddddd,1,0]
[tr=rgb(245, 245, 245)][td]运算符[/td][td]名称[/td][td]例子[/td][td]结果[/td][/tr]
[tr=rgb(255, 255, 255)][td]+[/td][td]加法[/td][td]$x + $y[/td][td]$x 与 $y 求和[/td][/tr]
[tr=rgb(245, 245, 245)][td]-[/td][td]减法[/td][td]$x - $y[/td][td]$x 与 $y 的差数[/td][/tr]
[tr=rgb(255, 255, 255)][td]*[/td][td]乘法[/td][td]$x * $y[/td][td]$x 与 $y 的乘积[/td][/tr]
[tr=rgb(245, 245, 245)][td]/[/td][td]除法[/td][td]$x / $y[/td][td]$x 与 $y 的商数[/td][/tr]
[tr=rgb(255, 255, 255)][td]%[/td][td]模数[/td][td]$x % $y[/td][td]$x 除 $y 的余数[/td][/tr]
[/table][p=21, null, left]下例展示了使用不同算数运算符的不同结果:[/p]实例<?php $x=10; $y=6;echo ($x + $y); [color=rgb(153, 153, 153)]// 输出 16echo ($x - $y); [color=rgb(153, 153, 153)]// 输出 4echo ($x * $y); [color=rgb(153, 153, 153)]// 输出 60echo ($x / $y); [color=rgb(153, 153, 153)]// 输出 1.6666666666667echo ($x % $y); [color=rgb(153, 153, 153)]// 输出 4?>[p=21, null, center][color=rgb(255, 255, 255)][backcolor=rgb(233, 104, 107)][color=rgb(255, 255, 255)]运行实例[/p]

[color=rgb(0, 0, 0)][backcolor=rgb(253, 252, 248)]PHP 赋值运算符[p=21, null, left]PHP 赋值运算符用于向变量写值。[/p][p=21, null, left]PHP 中基础的赋值运算符是 "="。这意味着右侧赋值表达式会为左侧运算数设置值。[/p][table=100%,#ffffff,#dddddd,1,0]
[tr=rgb(245, 245, 245)][td]赋值[/td][td]等同于[/td][td]描述[/td][/tr]
[tr=rgb(255, 255, 255)][td]x = y[/td][td]x = y[/td][td]右侧表达式为左侧运算数设置值。[/td][/tr]
[tr=rgb(245, 245, 245)][td]x += y[/td][td]x = x + y[/td][td]加[/td][/tr]
[tr=rgb(255, 255, 255)][td]x -= y[/td][td]x = x - y[/td][td]减[/td][/tr]
[tr=rgb(245, 245, 245)][td]x *= y[/td][td]x = x * y[/td][td]乘[/td][/tr]
[tr=rgb(255, 255, 255)][td]x /= y[/td][td]x = x / y[/td][td]除[/td][/tr]
[tr=rgb(245, 245, 245)][td]x %= y[/td][td]x = x % y[/td][td]模数[/td][/tr]
[/table][p=21, null, left]下例展示了使用不同赋值运算符的不同结果:[/p]实例<?php $x=10; echo $x; [color=rgb(153, 153, 153)]// 输出 10$y=20; $y += 100;echo $y; [color=rgb(153, 153, 153)]// 输出 120$z=50;$z -= 25;echo $z; [color=rgb(153, 153, 153)]// 输出 25$i=5;$i *= 6;echo $i; [color=rgb(153, 153, 153)]// 输出 30$j=10;$j /= 5;echo $j; [color=rgb(153, 153, 153)]// 输出 2$k=15;$k %= 4;echo $k; [color=rgb(153, 153, 153)]// 输出 3?>[p=21, null, center][color=rgb(255, 255, 255)][backcolor=rgb(233, 104, 107)][color=rgb(255, 255, 255)]运行实例[/p]

[color=rgb(0, 0, 0)][backcolor=rgb(253, 252, 248)]PHP 字符串运算符[tr=rgb(245, 245, 245)][td]运算符[tr=rgb(255, 255, 255)][td].[tr=rgb(245, 245, 245)][td].=
名称例子结果
串接$txt1 = "Hello" $txt2 = $txt1 . " world!"现在 $txt2 包含 "Hello world!"
串接赋值$txt1 = "Hello" $txt1 .= " world!"现在 $txt1 包含 "Hello world!"
[p=21, null, left]下例展示了使用字符串运算符的结果:[/p]实例<?php$a = "Hello";$b = $a . " world!";echo $b; [color=rgb(153, 153, 153)]// 输出 Hello world!$x="Hello";$x .= " world!";echo $x; [color=rgb(153, 153, 153)]// 输出 Hello world!?>[p=21, null, center][color=rgb(255, 255, 255)][backcolor=rgb(233, 104, 107)][color=rgb(255, 255, 255)]运行实例[/p]

[color=rgb(0, 0, 0)][backcolor=rgb(253, 252, 248)]PHP 递增/递减运算符[tr=rgb(245, 245, 245)][td]运算符[tr=rgb(255, 255, 255)][td]++$x[tr=rgb(245, 245, 245)][td]$x++[tr=rgb(255, 255, 255)][td]--$x[tr=rgb(245, 245, 245)][td]$x--
名称描述
前递增$x 加一递增,然后返回 $x
后递增返回 $x,然后 $x 加一递增
前递减$x 减一递减,然后返回 $x
后递减返回 $x,然后 $x 减一递减
[p=21, null, left]下例展示了使用不同递增/递减运算符的不同结果:[/p]实例<?php$x=10; echo ++$x; [color=rgb(153, 153, 153)]// 输出 11$y=10; echo $y++; [color=rgb(153, 153, 153)]// 输出 10$z=5;echo --$z; [color=rgb(153, 153, 153)]// 输出 4$i=5;echo $i--; [color=rgb(153, 153, 153)]// 输出 5?>[p=21, null, center][color=rgb(255, 255, 255)][backcolor=rgb(233, 104, 107)][color=rgb(255, 255, 255)]运行实例[/p]

[color=rgb(0, 0, 0)][backcolor=rgb(253, 252, 248)]PHP 比较运算符[p=21, null, left]PHP 比较运算符用于比较两个值(数字或字符串):[/p][tr=rgb(245, 245, 245)][td]运算符[tr=rgb(255, 255, 255)][td]==[tr=rgb(245, 245, 245)][td]===[tr=rgb(255, 255, 255)][td]!=[tr=rgb(245, 245, 245)][td]<>[tr=rgb(255, 255, 255)][td]!==[tr=rgb(245, 245, 245)][td]>[tr=rgb(255, 255, 255)][td]<[tr=rgb(245, 245, 245)][td]>=[tr=rgb(255, 255, 255)][td]<=
名称例子结果
等于$x == $y如果 $x 等于 $y,则返回 true。
全等(完全相同)$x === $y如果 $x 等于 $y,且它们类型相同,则返回 true。
不等于$x != $y如果 $x 不等于 $y,则返回 true。
不等于$x <> $y如果 $x 不等于 $y,则返回 true。
不全等(完全不同)$x !== $y如果 $x 不等于 $y,或它们类型不相同,则返回 true。
大于$x > $y如果 $x 大于 $y,则返回 true。
小于$x < $y如果 $x 小于 $y,则返回 true。
大于或等于$x >= $y如果 $x 大于或者等于 $y,则返回 true.
小于或等于$x <= $y如果 $x 小于或者等于 $y,则返回 true。
[p=21, null, left]下例展示了使用某些比较运算符的不同结果:[/p]实例<?php$x=100; $y="100";var_dump($x == $y);echo "<br>";var_dump($x === $y);echo "<br>";var_dump($x != $y);echo "<br>";var_dump($x !== $y);echo "<br>";$a=50;$b=90;var_dump($a > $b);echo "<br>";var_dump($a < $b);?>[p=21, null, center][color=rgb(255, 255, 255)][backcolor=rgb(233, 104, 107)][color=rgb(255, 255, 255)]运行实例[/p]

[color=rgb(0, 0, 0)][backcolor=rgb(253, 252, 248)]PHP 逻辑运算符[tr=rgb(245, 245, 245)][td]运算符[tr=rgb(255, 255, 255)][td]and[tr=rgb(245, 245, 245)][td]or[tr=rgb(255, 255, 255)][td]xor[tr=rgb(245, 245, 245)][td]&&[tr=rgb(255, 255, 255)][td]||[tr=rgb(245, 245, 245)][td]!
名称例子结果
$x and $y如果 $x 和 $y 都为 true,则返回 true。
$x or $y如果 $x 和 $y 至少有一个为 true,则返回 true。
异或$x xor $y如果 $x 和 $y 有且仅有一个为 true,则返回 true。
$x && $y如果 $x 和 $y 都为 true,则返回 true。
$x || $y如果 $x 和 $y 至少有一个为 true,则返回 true。
!$x如果 $x 不为 true,则返回 true。

[color=rgb(0, 0, 0)][backcolor=rgb(253, 252, 248)]PHP 数组运算符[p=21, null, left]PHP 数组运算符用于比较数组:[/p][tr=rgb(245, 245, 245)][td]运算符[tr=rgb(255, 255, 255)][td]+[tr=rgb(245, 245, 245)][td]==[tr=rgb(255, 255, 255)][td]===[tr=rgb(245, 245, 245)][td]!=[tr=rgb(255, 255, 255)][td]<>[tr=rgb(245, 245, 245)][td]!==
名称例子结果
联合$x + $y$x 和 $y 的联合(但不覆盖重复的键)
相等$x == $y如果 $x 和 $y 拥有相同的键/值对,则返回 true。
全等$x === $y如果 $x 和 $y 拥有相同的键/值对,且顺序相同类型相同,则返回 true。
不相等$x != $y如果 $x 不等于 $y,则返回 true。
不相等$x <> $y如果 $x 不等于 $y,则返回 true。
不全等$x !== $y如果 $x 与 $y 完全不同,则返回 true。
[p=21, null, left]下例展示了使用不同数组运算符的不同结果:[/p]实例<?php$x = array("a" => "red", "b" => "green"); $y = array("c" => "blue", "d" => "yellow"); $z = $x + $y; [color=rgb(153, 153, 153)]// $x 与 $y 的联合var_dump($z);var_dump($x == $y);var_dump($x === $y);var_dump($x != $y);var_dump($x <> $y);var_dump($x !== $y);?>[p=21, null, center][color=rgb(255, 255, 255)][backcolor=rgb(233, 104, 107)][color=rgb(255, 255, 255)]运行实例[/p]


游客
登录后才可以回帖,登录 或者 注册