In programming to look up the manual is indispensable, so you will learn to use the existing things, as in PHP, the array processing function already has a sort function, why write something is a hard to write bubble or heap row or fast row.
Maybe we all understand these, as do not understand I guess the meaning of this interface, he is in order to call the next time to call the implementation of the interface in the class of the content, good around the mouth ah, write an example to
The simplest PHP statement imports the database *.sql file into the database
Copy Code code as follows:
$sql =file_get_contents ("Text.sql"); Read the SQL statement as a string into the $sql
$a =explode (";", $sql); Use the explode ()
One, data caching
The data cache mentioned here refers to the database query cache, every time you visit the page, you will first detect the existence of the corresponding cached data, if it does not exist, connect the database, get the data, and
Today in the 64-bit red Hat Enterprise Linux as Release 4.7 Compile PHP5.2.6 error, MySQL is used by the RPM method installed, PHP compiled code as follows:
1.array_merge () Merge
Example
$array = Array (' A ' => ' BB ');
$array 2 = Array (' B ' => ' cc ');
$array 3 = Array_merge ($array, $array 2);
Output is
Array ([a] => BB [b] => cc)
It's all right because it's all arrays, and if we're
1, the input information to verify the class (mainly used to verify the user name, password, duplicate password, mailbox, can add other functions)
Copy Code code as follows:
/**
* Validator for Register.
*/
Final class
In the PHP program needs to use the C code, should be the following two kinds of cases:
1 already have C code, in PHP program want to use directly2 due to PHP performance problems, need to use C to achieve some of the functions
In the first case,
PHP and JavaScript are beginners. There is a need recently:
For example, there is a multiple-line PHP string:
$a =
When passed to JavaScript, it is equivalent to:
var c= ' thy38\n\
csdn\n\
blog ';
Because the
Dispatch is a small PHP framework. It does not give you complete MVC settings, but you can define URL rules and methods to better organize your applications. This is perfect for APIs, simple sites, or prototypes.
Copy Code code as follows:
Tonight, when writing a form validation class for a framework, you need to determine whether a string length is within a specified range, and naturally, think of the strlen function in PHP.
Copy Code code as follows:
$str = ' Hello
Google translation today, found a good thing: Google Translate_tts, call this API can hear English pronunciation,
Saves yourself the hassle of uploading audio files.
I used PHP to write a method called to save the audio file locally.
As follows:
Reset (PHP 3, PHP 4, PHP 5)Reset--Points the array's internal pointer to the first cell
DescriptionMixed reset (array &array)Reset () returns the array's internal pointer back to the first cell and returns the value of the first array cell, FALSE
PHP code to read the file header to determine the type of file, support pictures, RAR, exe and other suffixes.
Case:
Copy Code code as follows:
The path to the picture can be d:/upload/11.jpg and so on absolute path
$file = fopen ($
Today in doing a Sina login function, Sina provides the PHP SDK needs to use the Curl_init () function, in the debugging time can not find the Curl_init () method.
After the search to know that you need to open curl PHP expansion, then what is curl?
Let's check our PHP first to see if we've opened the GD library.
Copy Code code as follows:
if (extension_loaded (' GD ')) {
Echo ' You can use gd ';
foreach (Gd_info () as $cate => $value)
echo "$cate: $value ";
}else
Echo
Static variables exist only within the scope of a function, and static variables live only on the stack. Normal variables are released after the function ends, such as local variables, but static variables do not. The next time the function is
There are 4 code examples where do you think they create objects and get the speed ordering of the member variables?
1: Set member variable to public, assign value to member variable by assignment operation, get variable directly
Copy Code
When debugging open source code, you want to see the definition of a function, you need to locate its location. In an IDE like Zend Studio, you can automatically prompt, but what can we do when there is no such development tool installed? Refer to
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