PHP Program Performance Optimization Special Recommendation

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,

PHP checkdate () to determine whether the date function

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 Tutorial

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

PHP Get multi-checkbox checkbox value [multi-selection box]

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

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

PHP Explode implode usage

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

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.

PHP User Registration procedure [prevent Chinese registration]

Header ("content-type:text/html;charset=gb2312"); require_once (' inc/connect.php '); $xm = Isset ($_get[' txt '])? $_get[' txt ']: ' null '; $ta =isset ($_get[' tag '])? $_get[' tag ']:3; If ($ta ==1) {  if (Preg_match ("/^[". Chr (0XA1). -".

PHP Date function problem

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).

PHP unlink Delete Files

Public Function Removepic ($pic) {if (@unlink ($this->path $pic) && @unlink ($this->path.str_replace ($this->pre_thumb, $this->pre_ Pic, $pic))) {$this->pic_count--;return true;}else{$this->reporterr ($this->aerr[6]);Return "!        F "; Delete

PHP switch and if else difference

Switch ($id) {Case 1:Return ' asp/';BreakCase 2:Return ' phper/';BreakCase 3:Return ' jsp/';BreakDefaultReturn ' rubbish/';} If Else implementation if ($systype = = 1 | | | $systype = 2 | | | $systype = 3 | | | $systype = 4) {return $sever;}elseif

PHP explode and implode usage and difference

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

Simplest php code for deleting directories and files

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 '));?>

Simple php image uploads automatically add watermarks to images

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

Detailed analysis of php json instance

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:

Considerations for 301/404 redirection in php header

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

Php array add and delete element program code

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",

PHP uses session and cookies to prevent repeated submission of instances

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

PHP obtains the Flash playback addresses on the pages of major video websites.

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

Php implements adding internal links with keyword in the article content

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:

Total Pages: 12780 1 .... 4187 4188 4189 4190 4191 .... 12780 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.