Summary of common string functions in PHP

Source: Internet
Author: User

a function of judging type
Is_bool()//to determine whether it is a Boolean typeis_float()//determines whether a floating-point typeIs_real()//Ibid .Is_int()//determine if the integer typeIs_integer()//Ibid .is_string()//determines whether a stringIs_object()//determines whether an objectIs_array()//determines whether an arrayIs_null()//Determine if NULLIs_file()//determine if the file isIs_dir()//determine if the directoryIs_numeric()//determine whether a numberIs_nan()//Judging is not a numberIs_resource()//determine if a resource typeis_a($obj,$classname)//determines whether an object is an instance of a class//available if ($obj instanceof Classname)

second, get the sub-string position
Strpos($HS,$nd[, int$offset= 0])//returns the number position of the first occurrence of ND in the HS. Stripos($HS,$nd[, int$offset= 0])//returns the number position of the first occurrence of ND in the HS, not case-sensitive. Strrpos($HS,$nd[, int$offset= 0])//returns the position of the last digit of ND in the HS. Strripos($HS,$nd[, int$offset= 0])//returns the number position of the last occurrence of ND in the HS, not case-sensitive. 

third, get the sub-string
substr($str,$start[,$length]);//Get child stringstrstr($hys,$nd[, BOOL$before _needle=false]);//returns the string $nd the first occurrence of the $hys to the end of the string//third argument if True returns the string before $ndStristr($hys,$nd[, BOOL$before _needle=false]);//Ibid., Ignoring case versionsSTRRCHR($hys,$nd);//returns the string $nd the last occurrence of the $hys to the end of the string//General and substr (STRRCHR ($hys, $nd), strlen ($nd));

Iv. Replacement function

Str_replace($search,$replace,$subject[,&$count]);//Search and replace the string//fourth parameter is assigned, will be assigned to the number of times he replacedStr_ireplace($search,$replace,$subject[,&$count]);//Search and replace string//Fourth parameter is specified, will be assigned to the number of times he is replaced ignores caseSubstr_replace($string,$replacement,$start[,$length]);//string substring substitution//$replacement replace $string substring with length from startSTRTR($str,$from,$to)//returns a copy of Str and converts the character specified in the From to the corresponding character in to

Summary of common string functions in PHP

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.