Three functions strstr, stristr, and strpos are provided in php for character search. The usage of these three functions is somewhat different. Next we will introduce the relevant functions.
Syntax:String strstr (string haystack, string
The article summarizes the optimization and optimization code in php, which provides php programmers with a good idea.
1. If the class method can be defined as static, it should be defined as static as much as possible, and its speed will be
In php, we can use apache to implement pseudo-static or php operations, but currently I only know apache's pseudo-static and php code's pseudo-static.
Apache pseudo-static html (URL Rewrite) Setting Method
Phpma: Open the configuration file httpd.
A simple php splitting string and loop output learning notebook for your reference.
Example 1
The Code is as follows:
Copy code
$ Test = '2014 372115,850965403 ';$ R = explode (",", $ test );For ($ I = 0; $ I {Echo $ I. ".". $
There are many ways to delete an array element in php, but the common method is to use the unset function. But how can we reconstruct the array index after deleting the array element in the middle, for more information, see.
The Code is as
The strcmp () function is used to compare two strings. If the two strings are completely equal, 0 is returned. Otherwise, various return values are returned. This function is case-sensitive and can be used as a reference.
Return Value After
This article introduces how to obtain the ID value of the inserted data in php. php provides the mysql_insert_id () function. We only need to add echo mysql_insert_id () after inserting data.
Example
The Code is as follows:
Copy code
This article introduces the singleton mode of php design mode instances. For more information, see reference.
Singleton class:
1. the constructor must be marked as private. The Singleton class cannot be instantiated in other classes and can only be
There are several reasons for Chinese garbled characters on PHP pages. One is that the page encoding is not counted. The other is that no encoding is set in the database. The third is that there is a problem with apache encoding, the following two
At school, our teacher told us that there will be many algorithms for program data sorting. In fact, the bubble algorithm is a commonly used sorting algorithm. Next I will use php to Implement Bubble sorting, and record it below.
Example 1
This article introduces a paginator php paging program code. If you need it, you can refer to it.
The Code is as follows:
Copy code
Class paginator {Function _ construct (){}Static function render ($ page_type, array $ args =
The autoload mechanism makes it possible for PHP programs to automatically include class files when using classes, rather than include all class files at the beginning. This mechanism is also called lazy loading.
The following is an example of using
To generate random data in php, we can use rand and mt_rand to generate random data within the specified range. The following section will introduce the method to you.
Call mt_rand () to generate a random number. The parameter is the minimum and
Generate verification code a php code to generate the verification code and customize the session directory. This is not php. the default session file path in ini is saved, as shown in session_save_path below. You can redefine the
This article provides a php course Chinese Character Verification Code Generation Program. If you want to generate Chinese Characters in an image, you need the font file and the imagettftext function. If you want to use it, search for it online. If
This article introduces a very good php program for generating verification codes. First, when the user requests HTTP, the server creates a unique sessionid, which is the session ID, then, start the GD library or imagemagick painting tools, write
Using php to back up a mysql database is a feature provided by many personal webmaster websites. Of course, if you want to back up a few GB or larger databases, the php backup method is a bit difficult.
PHP backs up the source code of the mysql
In php, the list function is used to assign values in the array to some variables. In this way, we can use list to implement simple data operations. For more information, see.
Note: list () can only be used as an array of numeric indexes. It is
The article focuses on the usage of foreach loop and list loop statements. Let's take a look at the implementation below. If you need more, you can refer to it.
I recently bought php and mysql web development and saw the array loop statements. It is
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