Nothing is more worth mentioning than reading the manual-you can learn a lot by reading the manual, especially a lot of functions related to strings and arrays. There are many useful functions in these functions. if you read the manual carefully,
In most programming languages, the return keyword can return the execution result of the function, and the return usage in PHP is similar. for beginners, understanding the use of return in PHP is also the beginning of learning PHP. In most
Some ideas raised by the phpin_array function today I suddenly thought that the in_array function in php has a strange usage. let's take a look at this usage. a friend in need can give a simple reference. the code is as follows:
$ A = array ("1, 2
Common php functions are collected and explained in the appendix. as a php programmer, it is necessary to master and familiarize yourself with some common php functions. The author will collect the php Array Information, php System, php file
The php case-sensitive letter function provides a php case-sensitive letter function for simple instances. it is a convenient and common function to find the number of uppercase letters and lowercase letters in a string, the code is as follows:
Php filters all HTML tags. The article provides two php filters for all HTML tags. it can filter all html tags and remove html tags. the code is as follows:
Function text2html ($ txt ){
$ Txt = str_replace ("", "", $ txt );
$ Txt = str_replace (
The substr_compare () function, a common string comparison function in php, compares two strings starting from the specified length. This function returns:
0-if the two strings are equal, 0-if string1 (starting position) is greater than
Phpstrtotime function and instance tutorial strtotime (string $ time [, meaning $ now]) int strtotime (string $ time [, int $ now] This function expects to get a date format that contains American English, and will try to parse it into a Unix
Php array lookup key functions provide three methods to determine whether a string contains the words we have defined. this is more suitable for keyword filtering in the message, comment, and other addresses. the instance code is as follows:
$ Crud
Note: When using the phpin_array function, PHP is a weak language. when using the IN_ARRAY function, try to include the third parameter. the code is as follows:
Var_dump (in_array (0, array ('s', 'SS'), true); // return false
Var_dump
The phpaddslashessql anti-injection function addslashes can automatically enclose the single quotation marks and add \\\\\\ to the double quotation marks. This way, we can securely store the data into the database without the use of hackers,
Phprand () random function generation with the number of code first to understand the random number function rand () provided by php, php's rand () function will return a random integer, the specific use method is as follows:
Rand (min, max)
The
The php string and Chinese character splitting method are directly separated using the php function "str_split". garbled characters may occur because the Chinese character length is different from the English character length, however, we can create
The code for automatically adding data to php lazy functions is as follows:
/** @ Automatically add a data function * @ $ table name * @ $ arr field Library array ("title", array ("content", int )) * @ array (field, type) * @ type description html
The date () function of PHP is used to format the time or date. The PHPDate () function PHPDate () can format the timestamp as a date and time with better readability. The format parameter description is required for the syntax date (format,
Using cookies and user sessions PHP contains many functions that can be used to manage and record user information, including simple cookies and comprehensive user sessions. Sessions use PHP built-in techniques... PHP contains many functions that
Inheritance and polymorphism are the characteristics of object-oriented programming. Using inheritance, you can create a subclass based on a parent class. this subclass not only has the attributes and methods of the parent class, you can also create
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service