Summary of the classification of PHP string Functions _php Tutorial

Source: Internet
Author: User
Tags ming
Strpos returns the position of the first occurrence of string A in string B (returns the result as a number)

The inverse of the PHP string function is Strrpos returns the last occurrence of string A in string B (returns the result as a number)

Addcslashes to the specified character preceded by a backslash "" such as Echo addcslashes ($string, "y,o"); Adds a backslash "" before the specified character "Y,o"

Addslashes "" Special character refers to single quotation marks, double quotation marks, null and backslash "" in front of a specific character in a string

Strstr gets the substring at the end of string B that specifies the position of the first occurrence of string A in string b

STRRCHR Gets the substring that specifies the last occurrence of string A in string B to the end of string b

The Array_push function is used to increase the specified value to the end of the array $array =array ("0" = "Ming", "1" and "Day"); Array_push ($array, "technology");

Print_r ($array); Operation result is Array ([0]=> Ming [1]=> Day [2]=> technology);

The inverse of the PHP string function is array_unshift used to increment the specified value to the beginning of the array

The Array_pop function returns the last element of an array, and the opposite function is the Array_shift function, which returns the first element of an array

The Array_unique function removes duplicate values from the specified array and returns a new array

The Array_merge function is used to combine multiple numbers together and return a new array

The Array_slice function is used to extract an array element of the specified length from the specified position of the array, and to save the extracted elements to a new array, such as $array=array ("I", "yes", "Hu", "Rain", "Xuan");

$array 1=array_slice ($array, 2, 3);

The value of $array 1 is "Hu Yuxuan"

The inverse of the PHP string function is the Array_splice function that deletes the specified number of array elements from the specified position in the array and saves the deleted element to the new array


http://www.bkjia.com/PHPjc/446233.html www.bkjia.com true http://www.bkjia.com/PHPjc/446233.html techarticle Strpos Returns the position of the first occurrence of string A in string B (The return result is a number), and the inverse of the PHP string function is Strrpos returns the position of the last occurrence of string A in string B ...

  • 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.