%< code>” takes remainder operation (modulo operation), $a%$b;< ul>"; 输出 7 -="$b" -1 *="$b" 12 0.75 % 3 ?>< pre>output result: title="1634179864228803.png"
it can be concluded using arithmetic gives results. assignment operator<
we call="(equal" sign) operator as operator, is used assign values to variables, is, on right side equal sign variable left sign, becomes side. =< code>"addition = is: add the assigned left.
"-=< code>" subtraction -= change subtract " *=< *= multiply division divide "%=< example remainder: %= evaluated modulo result ".=< splicing .= . append characters $b="100;" ($a 的值为7 的值为3 的值为12 =="=" $b).'
'; seen that: equivalent $ x $y.< string there only which english period connect two strings splice them into new string. p>
##php increment decrement operator< ul>in our daily use, suitable use when there operands, but operand, " " "< code>--" operator. code>< first increase decrease by 1 then original variable, called prefix (prefix auto-increment self-decrement operator);<
put after first return current 1, post-increment ( post-increment operators). < li>
'; 输出结果为4 $b++.'
'; --$c.'
'; $d--.'
'; 输出结果为6 pre>< ul>output
<
##php comparison operator < li>php compare (numbers strings) ="=" comparison to, if $y, true. < , 如果 等于 $y,且它们类型相同,则返回 true < ! 用于比较不等于 ,例: !="=" , 不等于 $y,则返回 true。 < 用于比较不等于,例: $y $y,且它们类型不相同,则返回 >< 用于比较大于,例:$x 如果 大于 用于比较小于,例: >="
" 用于比较大于或等于 ,例: 大于或者等于
用于比较小于或等于 $x var_dump($x $y); "
"; var_dump($a $b); < pre>输出结果:
< >
php逻辑运算符< &&< code>与逻辑运算符,例:$x && 和 都为 true,则返回 true。
< ||< code>或逻辑运算符,例:$x || $y, 至少有一个为 < code>非逻辑运算符,例:!$x 不为 header("content-type:text html;charset="utf-8");" 逻辑与(并且),要求两个都为true才执行真区间,所以代码中执行假区间 if($x $y){ '好好学习'; }else{ '天天向上'; } pre>输出结果:<
输出天天向上,所以刚才输出了假区间。< $foo="false;" $bar="true;" 逻辑或,有一个为真则为真 if($foo $bar){ '福如东海'; '寿比南山';
输出福如东海,逻辑或,有一个为真则为真,所以输出了真区间。< 逻辑非,把false变为了true if(!$foo){
输出好好学习,逻辑非,把flase变成了true,输出了真。<
推荐学习:《php视频教程< a>》< p>
The above is the detailed content of Nanny-level sharing of basic PHP operators. For more information, please follow other related articles on the PHP Chinese website!
in>