1. The difference between single and double quotes
Most PHP developers (including me before) don't care much about their usage, but there's a big difference.
The PHP engine allows the use of single and double quotes to encapsulate string variables,
Definitions and usageThe Checkdate () function verifies a Gregorian high date.
If the specified value is valid, the function returns True, otherwise it returns false.
The date is legal in the following cases:
Month between and including 1-12The
PHP Array Operation Instance TutorialEach cell in the data array represents a row in a table. This is the typical way the database holds array data.The data in the example are as follows:Volume | Edition-------+--------67 | 286 | 185 | 698 | 286 | 66
checkbox in PHP to read the value in the array form Oh, we read these values in PHP post fetch is in an array form Oh,
php Get checkbox value for multiple marquee $area _arr = Array ();if ($_get[' action ']== "submit") {$area _arr = $_post[' area ']
Comparison between PHP strtr and Str_replace
Functions have the ability to replace characters. But the STRTR is 4 times times more than the str_replace performance. Specific circumstances, please
Look at the following decomposition:
The first is
Explode (symbols, characters)
The characters processed by explode will eventually be saved in an array form, so let's take a look at an example below.
$t = ' 9,133, Dan County ^14,203, Changsha ^14,206, Hengyang ';
$ar = Explode (', ', $a);
PHP serialize,unserialize function
We often see serialize,unserialize these two functions in PHP, so what are their roles?
Serialize can convert any data into a stored character oh, and then unserialize restore, here we look at
An instance.
Returns timestamp for 12:25:23 9-jul-2006echo Gmmktime (12,25,23,7,9,2006);?>
Gmdate ($format, $ts)
This function formats the UNIX time label as a date string that can be read artificially. This date string is represented as GMT (not local time).
function Htmltemplate ($tag) {$url = "file.txt";//file file contains the data I want to have and is bounded by .$content = file_get_contents ($url); Reading filesif (!empty ($content)) {$array = explode (' ', $content); to data processing and then
Example The code is as follows:Copy code // Delete all empty directories in the directoryArray_map ('rmdir', glob ('*', GLOB_ONLYDIR )); // Delete all files in the directoryArray_map ('unlink', array_filter (glob ('*'), 'is _ file '));?>
This article mainly implements php image upload to automatically add watermarks to images. In the next article, I will provide code for adding text watermarks with php.It is actually very easy for php to add watermarks to images. It is not as
JSON (json_encode) encoded in PHP)The PHP json_encode () function is used for JSON encoding in PHP. This function returns the value in JSON format. If it fails, FALSE is returned.Syntax:String json_encode ($ value [, $ options = 0]) parameter:Value:
301 jump The code is as follows:Copy code Header ('http/1.1 301 Moved Permanently ');Header ('Location: http://www.abc.com/aaa /');Exit (); Do not miss the header ('http/1.1 301 Moved Permanently '); otherwise, no 301 is returned.404 error page
Added the data element functions, including array_push () and array_unshift ().1. Add elements at the end of the array1. array_pushUsage The code is as follows:Copy code $ Stack = array ("orange", "banana ");Array_push ($ stack, "apple",
Prevents refresh or resubmitTherefore, we should consider adding a parameter to prevent such cases. Cookies and sessions are available. However, cookies are client-side. If cookies are disabled, we can refresh the clicks maliciously. Use the MD5
First look at a simpleThen I implemented this function using PHP. I think it is a pleasure to use PHP to do this job! With its powerful HTML page processing functions and regular expressions, you can use this function with just a few lines of
Example 1 The code is as follows:Copy code /*** Add links to keywords in the content* Only processes the keywords that appear for the first time, and does not add links to the existing links. It supports both Chinese and English* $ Content:
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