<?PHP//strlen ("AAA"); Take the length of the string * * * Echo strlen("AAAAA"); Echo"<br/>"; //$array = explode ("|", $s); splits the string, returns an array of strings * * * $str 1= "Aaaa|bbb|cc|d"; $array 1=Explode("|",$str 1); Print_r($array 1); Echo"<br/>"; Print_r(Explode("|",$str 1)); Echo"<br/>"; //$s = substr ($s, 4,10), intercept string, intercept based on the end position of the start position * * * $str 2= "Hello World"; Echo substr($str 2, 2,3); Echo"<br/>"; //strcmp ("AAA", "AAA"); compare two strings, same words output 0, different output-1//Case Sensitive Echo strcmp("AAA", "BBB");//-1 Echo"<br/>"; Echo strcmp("AAA", "AAA");//0 Echo"<br/>"; //strcasecmp ("AAA", "AAA"); compare two strings, case insensitive Echo strcasecmp("AA", "AA"); Echo"<br/>"; //strtolower ("abcdefgh"); Turn lowercase Echo Strtolower("AAAAAABBBB"); Echo"<br/>"; //Strtoupper (); turn caps Echo Strtoupper("AKJHAJKDHFJK"); Echo"<br/>"; //$s = implode ($array); converting an array to a string Echo implode($array 1); Echo"<br/>"; //$s = substr_replace ($s, "China"); Replace string with position $STR 3=Substr_replace($str 2, "Hello", 0,1); Echo $STR 3; Echo"<br/>"; //$s = str_replace ("L", "dog", $s); replacement string, equivalent to a lookup substitution in Notepad $STR 4=Str_replace("L", "You Come Over",$STR 3); Echo $STR 4;?>
Notes
String processing:
strlen ("AAA"); Take the length of the string * * *
strcmp ("AAA", "AAA"); compare two strings, same words output 0, different output-1
STRCASECMP ("AAA", "AAA"); compare two strings, case insensitive
Strtolower ("abcdefgh"); turn lowercase
Strtoupper (); turn caps
$array = Explode ("|", $s); splits the string, returns an array of strings * * *
$s = implode ($array); converting an array to a string
$s = substr_replace ($s, "China"); Replace string with position
$s = Str_replace ("L", "dog", $s); replacement string, equivalent to a lookup substitution in Notepad
$s = substr ($s, 4,10), intercept string, intercept based on the end position of the start position * * *
php--string