PHP has many built-in functions, most of which are widely used by developers. However, there are also some functions that are useful but forgotten in the corner. This article will introduce seven functions that are little-known but cool.1. highlight_
In a simple demo, You need to implement prompts and jump. The main page does not have high requirements and you do not need to use AJAX or JS.
So I learned how to prompt and jump in PHP.
Start using the following jump:Echo " ";
Alert contains the
Preg_match_all is used for global regular expression matching. This article mainly introduces information about preg_match_all. For more information, seePreg_match_all-perform global regular expression matching. The Code is as follows: int
Because the work needs to get the date of the previous month, next month, and this month, we found the implementation code from the website, and shared it to make it easier for our friends.When I was writing a program today, I suddenly found a
Use php to write a 1 GB file and check the hard disk write rate. There may be some errors,
We recommend that you use professional hard disk testing tools for testing.
Generally, the computer reads and writes at 20 Mb/s. This test takes about 40-50
Start using the following jump:Echo " ";
Alert contains the prompt message and href is the page to jump to after the prompt.
Later I remembered that there was a redirect () redirection method in the TP framework, so I went and looked at it.
1. The following example can remove Extra blank space.
The Code is as follows:
$ Str = "This line containstliberal rn use of whitespace. nn ";// First remove the leading/trailing whitespace// Remove the start and end
1. cookie data is stored in the client's browser, and session data is stored on the server.
2. Cookies are not very secure. Others can analyze the Cookies stored locally and perform cookie spoofing. session should be used for security reasons.
3.
PHP has a rich set of built-in functions that we have used. However, most of us are not familiar with, but they are very useful. In this article, I have listed some little-known PHP functions that will highlight your eyes.
Levenshtein ()
Have you
There are many string compression methods provided by php. The following describes the php string compression methods. For more information, seePhp provides the following string compression methods: 1.gz compress-Compress a string This function
Php provides the following string compression methods:1. gzcompress-Compress a stringThis function compress the given string using the ZLIB data format.2. gzencode-Create a gzip compressed stringThis function returns a compressed version of the
Calendar. class. php
Copy codeThe Code is as follows:Class Calendar {Private $ year; // current yearPrivate $ month; // the current monthPrivate $ start_weekday; // The day of the month corresponds to the day of the weekPrivate $ days; // The
Copy codeThe Code is as follows:Function getAgeByID ($ id ){// After this year's birthday, you will be 1 year old.If (empty ($ id) return '';$ Date = strtotime (substr ($ id, 6, 8 ));// Obtain the date of birth, month, and day$ Today = strtotime
The function of the PHPsession variable is to store the user's session information or change the user's session settings. The Session variable stores the information of a single user, which can be applied by all pages.
The PHP session variable is
In our website design process, multi-condition queries are often used. the source code of this article is an example of a second-hand house query. In this example, we need to obtain the materials required by the customer through the geographical
By default, php retains sessions by using the file method, which can be used only on windows with a low File space overhead, however, if we use a file system on the uinx or liux, the file space overhead of such a file system is very high. However,
For a while I have been confused about the transfer referenced in PHP. later I checked the manual and the C source program and repeated the test. I had a certain understanding of the mode in which the reference was passed in the memory, later, I
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