Home>Article>Backend Development> PHP's bitwise operators do not include that symbol

PHP's bitwise operators do not include that symbol

(*-*)浩
(*-*)浩 Original
2019-11-20 17:49:36 3450browse

PHP's bitwise operators do not include that symbol

#php bitwise operators allow the evaluation and operation of specified bits in an integer.(Recommended Learning:PHP Video Tutorial)

PHPs bitwise operators do not include that symbolSitering is a mathematical operation in PHP.Bits moved out in any direction are discarded. When shifting left, the right side is padded with zeros, and the sign bit is moved away, meaning that the sign is not preserved. When shifting right, the left side is padded with sign bits, which means the sign is preserved.

Use parentheses to ensure the desired priority. For example, $a & $b == true performs comparison first and then performs bitwise AND; while ($a & $b) == true performs bitwise AND first and then performs comparison.

If the two operands of &, | | and ^ operators are strings, the operation will be performed on the ASCII values of the characters that make up the string, and the result will be a string. In all other cases, both operands will be converted to integers and the result will be an integer.

If the operand of the ~ operator is a string, the operation will be performed on the ASCII values of the characters that make up the string and the result will be a string, otherwise the operand and result will be treated as integers.

The operands and results of the > operators are always treated as integers.

PHP 的 ini 设定 error_reporting 使用了按位的值, 提供了关闭某个位的真实例子。要显示除了提示级别 之外的所有错误,php.ini 中是这样用的: E_ALL & ~E_NOTICE
rrree

The above is the detailed content of PHP's bitwise operators do not include that symbol. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn