<?PHP$a= "@[email protected]"; $trim=Trim($a,‘@‘);//Remove the @//var_dump ($trim) on the left and right side; $ltrim=LTrim($a,‘@‘);//Remove the @//var_dump ($ltrim) on the left; $rtrim=RTrim($a,‘@‘);//Remove the @//var_dump ($rtrim) on the right; $strlen=strlen($a);//the length of the statistic string//var_dump ($strlen); $strrev=Strrev($a);//Invert string//var_dump ($strrev); $str _shuffle=Str_shuffle($a);//randomly scrambled string//var_dump ($str _shuffle); $explode=Explode(' A ',$a);//a split string is an array of//var_dump ($explode); $implode=implode(' A ',$explode);//put $explode this array using a stitching for string//var_dump ($implode); $str _replace=Str_replace(' A ', ' B ',$a);//string substitution replaces a in a $ A string with B//var_dump ($str _replace); $strpos=Strpos($a, ' Q ');//find the position where Q first appeared in $ A//var_dump ($strpos); $strrpos=Strrpos($a, ' Q ');//find the last position of Q in $ A//var_dump ($strrpos); $b= ' I love You '; $strtoupper=Strtoupper($b);//the string is converted to uppercase//var_dump ($strtoupper); $c= ' I Love You '; $strtolower=Strtolower($c);//the string is converted to lowercase//var_dump ($strtolower); $ucwords=Ucwords($b);//the first letter of each word in the string is capitalized//var_dump ($ucwords); $ucfirst=Ucfirst($b);//write//var_dump of the first letter of the string ($ucfirst); $substr=substr($a, '-1 ');//string interception starts from the countdown to the first intercept of//var_dump ($SUBSTR); $strstr=strstr($a, ' Q ');//finds the position where Q first appears in the string $ A and returns the position to the end of the string//var_dump ($STRSTR); $STRRCHR=STRRCHR($a, ' Q ');//Find Q Returns the string from this position to the end at the last occurrence of the string//var_dump ($STRRCHR); $str _repeat=str_repeat($a, ' 2 ');//repeat $ A of this string 2 times after the result//var_dump ($str _repeat);?>
Several commonly used PHP string functions