Php array deduplication instance and Analysis

Repeated items in one-dimensional array: Use the array_unique function. Use the following example:Copy codeThe Code is as follows:$ Aa = array ("apple", "banana", "pear", "apple", "wail", "watermalon ");$ Bb = array_unique ($ aa );Print_r ($ bb

PHP Regular Expression judge Chinese UTF-8 or GBK ideas and specific implementation

UTF-8 matching: In javascript, it is very easy to judge that the string is Chinese. For example:Copy codeThe Code is as follows:Var str = "php programming ";If (/^ [\ u4e00-\ u9fa5] + $/. test (str )){Alert ("all strings are Chinese ");} Else {Alert

Php code for string function reduction based on Chinese Characters

Copy codeThe Code is as follows:Define (CHARSET, 'utf-8'); // default system Encoding/*** Trim strings based on Chinese Characters* @ Param $ string-string* @ Param $ length-length* @ Param $ doc-thumbnail suffix* @ Return returns the string with

A small example of the default method specified by the php function

Content of this section:Specify the default value for the php function.In php programming, set the default value for the custom function. When you call this function, if you do not specify a value for the parameter, the parameter will be replaced by

Php retrieves a simple 301 jump URL instance

Copy codeThe Code is as follows:/*** Get_redirect_url ()* Gets the address that the provided URL redirects,* Or FALSE if there's no redirect.** @ Param string $ url* @ Return string*/Function get_redirect_url ($ url ){$ Redirect_url = null;$

Php uses curl to send data instances in json format

Copy codeThe Code is as follows:$ Urlcon = 'HTTP: // localhost/******. php ';$ Data = '{"Button ":[{"Type": "click ","Name": "Today's songs ","Key": "V1001_TODAY_MUSIC"},{"Type": "click ","Name": "Introduction to singers ","Key": "V1001_TODAY_SINGER"

Php Image Scaling

Copy codeThe Code is as follows:/*** The Images class is an image processing class.* @ Package application. controllers* @ Since 1.0*/Class Images{ /*** Scale an image* @ Param $ source Original Image* @ Param $ newfile New Image* @ Param $ pre zoom

Php text watermark and php image watermark implementation code (two watermarking methods)

Text watermark A text watermark adds text to an image. It mainly uses the imagefttext method of the gd library and requires a font file. As follows: The implementation code is as follows: Copy codeThe Code is as follows:$ Dst_path = 'dst.jpg '; //

Php: how to view request header information and obtain remote image size

To obtain the size of a remote image, a common practice is to first retrieve the content of the remote image and use strlen to calculate the length. In this way, you need to download the image before calculating it. If the image size is large,

Php intercepts Chinese strings without garbled characters

GBK encoding truncation example Copy codeThe Code is as follows:$ Str = 'Who Am I '; // A gbk-encoded stringEcho mb_substr ($ str, 0, 1, 'gbk'); // output me The mb_substr method has one more parameter than the substr method to specify string

PHP paging implementation (with renderings)

First, a paging class can be copied directly as follows (from the network ). Each_disNums = intval ($ each_disNums); $ this-> nums = intval ($ nums); if (! $ Current_page) {$ this-> current_page = 1;} else {$ this-> current_page = intval ($

Php $ _ server application

[Page] $ _ SERVER ['php _ SELF '] # File Name of the script being executed, which is related to document root.$ _ SERVER ['argv'] # parameters passed to the script.$ _ SERVER ['argc '] # contains the number of command line parameters passed to the

PHP function: set_time_limit ()

During the previous work, I encountered a PHP function: set_time_limit (). I thought this was a very simple function, but Baidu has published several articles and found that there are still many aspects worth attention when using this function.

Auto_prepend_file and auto_append_file in PHP

When developing PHP programs, we sometimes write the same code at the beginning and end of each PHP script. For example, we often need to open and close sessions on every PHP page or establish and close database connections. Good programmers usually

A simple php MongoDB operation class

A simple php mongodb operation class only writes a php query operation for the mongodb database. for other operations, see http://blog.php230.com/php-mongodb-database-operation.html. A simple php mongodb operation class, only write a php query

A php class simulating discuz posts

A php class simulating discuz posts Code: _ Db = db: get_instance ($ this-> host, $ this-> username, $ this-> password, $ this-> database_name ); $ this-> fid = $ fid; $ this-> title = $ title; $ this-> content = $ content; $ this-> author = $

Php Chinese string truncation

Php Chinese string truncation} the above method can be used to prevent garbled characters. Php Chinese string truncation Code: /*** String truncation * @ param $ string the string to be intercepted * @ param $ length the length of the int

Php uses XMLReader to parse XML

A tree-based parser. It stores the entire document in the data structure of the tree, that is, it must be loaded into the memory to work. Therefore, when processing large XML documents, the performance decreases dramatically. SimpleXML and DOM

Php import excel

The above section describes how to use php to export excel files. here is how to import excel files through php. The above section describes how to use php to export an excel file. here we will share the method of importing an excel file through

Php obtains the mac address of the local machine.

Php obtains the mac address of the local machine. How to obtain the mac address of a local machine using php Code: Forlinux (); break; case "solaris": break; case "unix": break; case "aix": break; default: $ this-> forwindows (); break ;} $

Total Pages: 12780 1 .... 10081 10082 10083 10084 10085 .... 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.