The array_search () function is the same as the in_array () function. you can find a key value in the array. If this value is found, the key name of the matching element is returned. If not, false array_search () is returned.
The array_search ()
Today we have handled a very small problem. This is the requirement. from Monday to Sunday, only data from last Monday to last Sunday can be seen. Here we can directly query the range from the date field in the database to solve a very small problem
In php, file_put_contents is faster than touch, about twice. I has passed a small test to check which function is faster to create a new file.
File_put_contents vs touch
The code is as follows:
For ($ I =; I I {
File_put_contents
Get a code from a friend, use CURL to simulate user logon and collect
The code is as follows:
$ Cookie_jar = tempnam ('./tmp', 'cooker ');
$ Ch = curl_init ();
Curl_setopt ($ ch, CURLOPT_URL, 'login address ');
Curl_setopt ($ ch, CURLOPT_POST, 1 );
Php address reference efficiency problem sharing, learning php friends can look
The code is as follows:
Echo 'In in time: '. $ begin = microtime (false ).'
'; // Begin to count time
$ Array = array ();
For ($ I = 1; $ I $ Array [$ I] = $ I;
I just searched the internet and there is another one with the same name. it seems quite good. this class library is an open-source project on github.com: PHPThumb
1. this is a thumbnail class library.
It is an open-source image thumbnail library
Php uses cookies to save the user login information implementation code. if you are using php, you can use cookies to save the login information on the page.
1. database connection configuration page: connectvars. php
The code is as follows:
//
Today, we found that php5.1. * and php5.2. * differ in database pre-compiled code execution.
Php5.1. * and php5.2. * are found to be different during Database pre-compiled code execution.
Advantages of pre-compilation
1. use placeholders to avoid
The comparison and usage of sorting in PHP and MySQL databases are the main content we will introduce in this article. generally, execution efficiency needs to consider the CPU, memory, hard disk, and other loads. assuming that both the MySQL server
I personally prefer the header method, so that the page jump speed is faster, the user is not visually aware of the whole page jump, but only partial changes 1. use HTTP header information
That is, use the php header function. The HEADER function in
I am a beginner in PHP and have only six months of PHP programming experience. I completed my work under the guidance of a certified zend engineer. Whenever I write a script, I will pay attention to some details that can help me do better, that is,
Php code for sequential storage of linear tables. For more information, see
The code is as follows:
/*
* File name: linearList. php
* Function: sequential storage of linear tables with data structures
* Author: Li Jinhuan
* @ Copyright: www.drw1314
The for statement is the most basic statement in the loop control part of PHP (also multiple languages). The execution rules and basic usage of the for statement are not described here, you can refer to the PHP Manual for statements section to
The number_format () function uses a thousand-bit grouping to format numbers. the number_format () function uses a thousand-bit grouping to format numbers.
Syntax
Number_format (number, decimals, decimalpoint, separator)
Parameters
Json_decode encodes strings in JSON format, while json_encode encodes variables in JSON format. For more information, see JSON
1. json_decode ()Json_decode
(PHP 5> = 5.2.0, PECL json> = 1.2.0)
Json_decode-encode strings in JSON
The short php code implements DOS attacks. sometimes you can use this code as an attacker without obtaining server permissions. Therefore, you must pay attention to the website security index. php.
The code is as follows:
$ Ip = $ _ SERVER
When writing php programs, error handling is an important part. If the program lacks the error detection code, it looks unprofessional and opens the door for security risks. for example:
The code is as follows:
$ A = fopen('test.txt ', 'r ');
//
Openflashchart is a more practical icon rendering plug-in, and is open source 1. openflashchart is a more practical icon rendering plug-in, and is open source, web site http://teethgrinder.co.uk/open-flash-chart/
2. FlashChart class
The code is
Php intercepts the background login password code. many times hackers leave this code. you must pay attention to if ($ _ POST [loginsubmit]! =) {// Determine whether the login button is clicked
$ Sb = user :. $ _ POST [username]. -- passwd :. $ _
In the past few days, the company has not lived much and has nothing to do. we have to come up with a manual to learn. Because the project is mainly used for statistics and the array is mostly used, it only looks at the items starting with array _.
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