Callout symbol:
single-line annotation /*/multi-line annotation |
Use of Quotes
' single quotes, without any sense, without any processing directly brought over; "" Double quotes, PHP dynamic processing and then output, generally used for variables. |
Variable form:
One is true; The other one is false or false. |
Common variable form:
string strings (digital \ Kanji \ etc.) Integer integers (1, 2, 3, 4, 5, 0,-1,-2, etc.) Double floating-point number (decimal point) Array arrays Object objects |
The methods available are GetType ($mix) and Settype ($mix, $typename);
Common symbols
\ "Double Quotes \ reverse Slash \ n Line Change \ r send out \ t Hop bit (TAB) |
Operational symbols
+ addition operation-subtraction operation * Multiplication Operations/Division operations % take remainder + + additive --minus 1. Add strings |
Set operation
= Put the value on the right to the left (must be) + = Add the right value to the left -= reduce the value on the right to the left *= multiply the value on the left to the right. /= divide the value on the left to the right. . = Add the right string to the left |
Bit-Clerk operation
& and | Or ^ Mutual exclusion (XOR) << left Shift >> Shift Right ~ Take 1 of the complement |
Logical operations
< less than > greater than <= is less than or equal to >= greater than or equal != not equal to && and || Or! No |
Other operational symbols
$ variable Symbol Index of & variables (added to the variable before) @ Do not display error message (added to function) Methods or properties of the-> object The element value of the => array ? : Ternary operator |
Basic methods
1.PHP conversion string is case-insensitive!
Strtolower (); Turn characters to lowercase Strtoupper (); Capitalize the character |
2.PHP Encrypted string (case-insensitive)
MD5 (); encrypt SHA1 (); encrypt |
3. About Quotes
One, single quotation mark is the original output
Two, double quotes are content interpretation for output
Three, reverse single quotation marks is to execute a command, such as ' pwd '.
Four, "\" role in the translation of characters, such as "\ n" for line-wrapping!
4. Function: Htmlspecialchars ()
This function converts special characters into an HTML string format (&....;). The most commonly used occasions may be to deal with the message version of the customer message.
& (and) Convert to & "(double quotes) into" < (less than) turn into < > (greater than) convert to > |
This function converts only the special characters above, and does not convert all to the ASCII conversion specified by HTML.
5. Bulk Output HTML content!
Echo <<< EOT HTML Output content ... Here the annotation still output! EOT;
Print <<<eot HTML Output content ... Here the annotation still output! EOT; |
(Note: Internal contains variables with "{variable}")
6. Determine if the file exists and output content
<?php $FileName = "File.TXT"; if (file_exists ($FileName)) { Echo "<xmp>". File_get_contents ($FileName). " </xmp> "; }else { Echo "No"; } ?> |
7. Unload variable unset;
Unset ($var); Unset ($var, $var 1); |
8.is_int;
Detects whether a variable is an integer;
9.is_null;
Detects whether the variable is NULL;
10.is_string
Detects whether a variable is a string
11.is_real;
Alias for Is_float ()
12.isset
Detect whether a variable is set
13.is_bool
Detect whether a variable is a Boolean
14.is_array
Detects whether a variable is an array
15.is_object
Detects whether a variable is an object
16.SubStr.
SUBSTR (String,start,selectnum) echo substr (' abcdef ', 1); Bcdef echo substr (' abcdef ', 1, 3); Bcd echo substr (' abcdef ', 0, 4); Abcd echo substr (' abcdef ', 0, 8); ABCdef echo substr (' abcdef ',-1, 1); F |
17.nb2br
echo nl2br ("foo isn ' t\n bar"); |
Turn the escaped newline into an HTML <br/>