Serial number | Symbol | Name | Function | Remarks | ||
1 | echo | Output character | Same as python’s print statement will be immediately followed by The string or variable value after is displayed on the page |
|||
2 | ; | semicolon | is used after the code to indicate the end | |||
3 | ?> | XML Markup style | is used to include code to distinguish it from html code Recommended, the server cannot be disabled |
echo "hello, world!"; ?> |
||
4 | < ;script language="php"> |
script style | ||||
5 | ?> |
Short style | Short style and ASP style need to be set in php.ini, set both short_open_tag and asp_tags to ON | echo 'hello, world!'; ?> |
||
6 | <% %> |
ASP style | Short style and ASP style need to be set in php.ini, set both short_open_tag and asp_tags for ON | <% echo 'hello, world!'; %> |
||
7 | // | comment symbol | C++ style | echo " | " echo " | "; |
Multi-line comments | */?> | 9 | # comment symbol shell style echo " | "; # C++ single line comment style | ||
10 | $ | variable identifier | All variables must be preceded by the '$' symbol |
|||
' ' | " "Single quotes | Double quotes | Variables contained in double quotes will be automatically replaced with actual values | Single quotes will be treated as ordinary strings Output|||
echo " "; | Display results hello ,world! | $i12 <<< definator 13 | ||||
convert to Boolean | (boolean)$num, (boolean) $str | |||||
(string) | converted into character type | (string)$boo, (string)$flo | ||||
(integer) | converted into integer type | ( integer)$boo, (integer)$str | ||||
(float) | convert to floating point type | (float)$str | ||||
(array) | convert to array | (array)$str | ||||
(object) | Convert to object | (object)$str | ||||
settype() | type conversion function | settype(needs to be converted Variable, converted type) | Return TRUE on success, or FALSE on failure$foo = "5bar"; // string | |||
settype($foo , "integer"); // $foo is now 5 (integer) | settype($bar, "string"); // $bar is now "1" (string)?> |
The above introduces PHP study notes (2) data types, including PHP learning and data types. I hope it will be helpful to friends who are interested in PHP tutorials. |
|