Home >Backend Development >PHP Tutorial >Special operation symbols and functions commonly used in PHP development
Annotation symbols:
// Single-line annotation
/* */Multi-line annotation
' ' Single quotation mark, a simple string, taken directly without any processing;
" "Double quotation mark, PHP dynamically processes and then outputs it, generally used to process $variables.
Boolean variables:
One is true, which is true;
The other is false, which is false.
Common variables:
string String ( Numbers\Chinese characters\etc.)
integer integer (1, 2, 3, 4, 5, 0, -1, -2, etc.)
double floating point number (decimal point)
array array
object Object
The methods that can be used are gettype($mix) and settype($mix,$typename);
Commonly used symbol escapes:
\" Double quotes
\\ Backslash
\n Newline
\r Return to the beginning of the line
\t Horizontal tab
Operation symbols:
+ Addition operation - Subtraction operation
* Multiplication operation/Division operation
% Take the remainder ++ Add 1 to yourself
-- Subtract 1 to yourself. Connect two strings
Assignment operation:
= Substitute the value on the right into the left
+= Add the value on the right to the left
-= Subtract the value on the right to the left
*= Multiply the value on the left by the right
/= Add the value on the left Divide the value by the right side
.= Add the string on the right side to the left side
Bitwise operations:
& Bitwise AND
| Bitwise or
^ Bitwise Exclusive OR (xor)
c4908cb9de66ceae570ee14a49a6ceb1> Shift 1 bit to the right
~ Complement
Logical operation:
897a132b13a557a1edf28abd0d2cf36b Greater than
740aabee6e76166822b61fc4938d2a57= Greater than or equal to
!= Not equal to && and
|| or! Other operation symbols other than
$ Variable symbol
& Variable alias
@ Do not display error message (add before function)
-> Method or property of object
=> Element value of array
?: Ternary operator
Commonly used basic methods:
1.PHP converts strings to upper and lower case!
strtolower(); Convert characters to lowercase
strtoupper(); Convert characters to uppercase
2.PHP encrypted string
Unreducible:
md5();
sha1();
Reducible:
base64_encode();
base64_decode();
3. About quotation marks
1. Single quotation marks are output as they are
2. Double quotation marks are content interpretation and output
3. Anti-single quotation marks (small quotation marks) are used to execute a system command, such as `dir`. Commonly used in table names and field names.
4. "\" acts on translation characters, such as "\n" which is a newline.
4.函数:htmlspecialchars() 和 htmlentities()
本函数将特殊字符转成 HTML 的字符串格式 ( &....; )。最常用到的场合可能就是处理客户留言的留言版了。
& (和) 转成 &
" (双引号) 转成 "
c3a13fc49a408b69205cac63ee2872de (大于) 转成 >
(空格)转成
5.批量输出HTML内容!
echo 5dba6f0b5cab928c56826e1daf0578d2
.code show as below:
echo nl2br("foo isn't\n bar");
The above is the detailed content of Special operation symbols and functions commonly used in PHP development. For more information, please follow other related articles on the PHP Chinese website!