Small example of array deduplication in php for beginners
The code is as follows:
Function assoc_unique ($ arr, $ key ){
$ Tmp_arr = array ();
Foreach ($ arr as $ k =>$ v ){
If (in_array ($ v [$ key], $ tmp_arr )){
Unset ($ arr [$ k]);
}
Preg_replace is used to search and replace regular expressions. if only strings are matched, str_replace () is recommended. because of its high execution efficiency, preg_replace is used to search and replace regular expressions, we recommend that
This article will implement the following functions: mobile phone number verification, mobile phone number, escape, convert string encoding to UTF8, interested friends can refer to, maybe this article is helpful to you
The code is as follows:
//
The JSON-related functions of PHP applications are json_encode ($ PHPcode), while the JSON-parsed functions of PHP applications are json_decode ($ JSONcode. We will introduce JSON in detail in this article
Processing of js returned data by php
In php, the quickest way to read files is to use functions such as file and file_get_contents, A few simple lines of code can perfectly complete the functions we need. However, when the operated file is a relatively large file, these functions are
The php code that intercepts the string and retains the complete xml tag. if you need it, refer
The code is as follows:
/**
* Author: goosman
* Blog: http://blog.csdn.net/lgg201
* Mail: lgg860911@yahoo.com.cn
*/
$ Str = '000000 ';
Function substr_
Php converts a string into a class referenced by an HTML object. if you need it, refer
The code is as follows:
Class HtmlEncode {
Static $ _ convertToHtmlEntitiesSrcEncoding = 'utf-8 ';
/**
* Convert a non-ASCII string to an HTML object
*
*
There are many methods to obtain the position of an element in the array. among them, PHP itself has a built-in function array_keys (). the following code can print all the built-in functions of PHP, if you are interested, you can learn how to use
Sometimes when we read the database output, we may need to sort the data by the Chinese user name. some new friends have no idea about this. next we will introduce the implementation method in detail in the small editor, if you are interested, you
The purpose of this code is to capture the error content when the php program we write goes wrong and send it to our email so that our friends who develop PHP by mistake will know that, in fact, the most worrying thing is that there are some
Today, I have read some official IBM documents and some XML-related documents. I have sorted out some key points and some examples of writing and reading XML in PHP for later use. use DOM to generate and read XML files
Instance 1:
The code is as
There are too many restrictions on the blog garden, so I decided to change my blog from the blog Garden (cnblogs. WORDPRESS has a good reputation, so I decided to use it for reference. Hundreds of logs sent earlier need to be imported. I searched
The FineUploader is used for browser adaptation. fineUploader implements file upload in ajax mode. if you need to upload files, you can refer to the need to upload files when processing background data recently. fine Uploader is used for browser
The following article mainly introduces some excel operation implementation code based on PHPEXCEL. For more information, see the following:
The code is as follows:
Require ("http://www.bitsCN.com/PHPExcel/Classes/PHPExcel.php ");
$ File = "D :\\
When collecting data, you often need to use the curl + regular expression method to collect the required data. based on your work experience, share some commonly used custom functions you have written with you. this is a series of articles that
Boolean is the simplest type in PHP. The value can be TRUE or FALSE.
Boolean is the simplest type in PHP. The value can be TRUE or FALSE.
For example:
$ Foo = false;$ Foo1 = true;When echo "is false, the output value is:". $ foo; // no output
This article summarizes some of the most easily forgotten knowledge points in PHP. For more information, see
1. Define constants:
The code is as follows:
// 1Define ("TAX_RATE", 0.08 );
Echo TAX_RATE; // output 0.08
// 2 (PHP 5.3)Const TAX_RATE2 =
This article introduces the sample code for simulating the get_headers function in php. For more information, see
The code is as follows:
02 if (! Function_exists ('Get _ headers ')){
03 function get_headers ($ url, $ format = 0 ){
04 $ url =
This article introduces the functions and usage of the get_headers function in php. For more information, see get_headers (). It is a PHP System-level function. it returns an array containing the header sent by the server to respond to an HTTP
Cut off the title of the article and control it in 15 texts. next we will explain how to implement this requirement. if you are interested, refer to Function: mb_substr ($ str, $ start, $ length, $ encoding)
$ Str: string to be truncated
$ Start:
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