Beginners must master basic common functions during learning! Summary: 1. PHP converts strings to uppercase and lowercase! & Amp; nbsp; strtolower (); lowercase & amp; nbsp; & amp; n
Beginners must master basic common functions during learning! Summary:
1. PHP converts strings to uppercase and lowercase!
Strtolower (); converts characters to lowercase letters
Strtoupper (); converts uppercase letters
2. PHP encrypted string (case sensitive)
Md5 (); encryption
Sha1 (); encryption
3. quotation marks
I. single quotes are output as is
2. double quotation marks are output based on content interpretation
3. a single quotation mark is used to execute a system command, such as 'dir '. Table names and field names are commonly used.
4. "\" acts on translated characters. for example, "\ n" is a line break.
4. Functions: htmlspecialchars () and htmlentities ()
This function converts special characters into HTML strings (&....;). The most common use case may be the message board for handling customer messages.
& (And) &
"(Double quotation marks)"
<(Less than) to <
> (Greater than) to>
(Space) to convert
This function only converts the preceding special characters and does not convert all of them into the ASCII conversion defined in HTML.
5. batch output HTML content!
Echo <EOT
HTML output content... // Comments are output here!
EOT;
Print < HTML output content... // Comments are output here!
EOT;
(Note: "{variable}" is used for internal variables }")
6. determine whether the file exists and the output content is file_exists ()
$ FileName = "File. TXT ";
If (file_exists ($ FileName )){
Echo"
".file_get_contents($FileName)."
";
} Else
{
Echo "no ";
}
?>
7. delete the variable to release the memory unset ();
Unset ($ var );
Unset ($ var, $ var1 );
8. is_numeric;
Checks whether the variable is a number;
9. is_int;
Checks whether the variable is an integer;
10. is_null;
Checks whether the variable is NULL;
11. is_string
Checks whether the variable is a string.
12. is_real;
Is_float () alias
13. isset
Check whether variables are defined
14. is_bool
Check whether the variable is Boolean
15. is_array
Checks whether the variable is an array.
16. is_object
Checks whether a variable is an object.
17. the substr () function returns part of the string.
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
18. nb2br () converts the escape line to html
Echo nl2br ("foo ISN'T \ n bar ");
Learning lies in continuous accumulation. php points work with you...