Phpstrcspn search string

Source: Internet
Author: User
The phpstrcspn () function returns the number of characters (including spaces) searched in the string before any specified character is found ). This article introduces the usage and examples of phpstrcspns to coders. if you need them, refer to this article. Definition and usage

The strcspn () function returns the number of characters (including spaces) to be searched in the string before any specified characters are found ).

Tip: Use the strspn () function to return the number of characters in the string that contain the specified character list.

Note: This function is binary secure.

Syntax
strcspn(string,char,start,length)
Parameters Description
String Required. Specifies the string to be searched.
Char Required. Specifies the characters to be searched.
Start Optional. Specifies where to start searching in the string.
Length Optional. Specifies the length of the string (the number of characters to search ).

Return value
Return value: Returns the number of characters found in the string before any part of the specified character is found.
PHP version: 4 +
Update Log: In PHP 4.3StartAndLengthParameters.

Instance

  "; // Output in the string" Hello world! The number of characters found before the character "w": echo strcspn ("Hello world! "," W ");?>

Online operation

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.