Ec (2); truncate the string mb_substr ($ str, star, count, encode); obtain the string length mb_strlen (); keep the complete text in textarea text by carriage return and line break str_replace (chr (10), & quot; & lt; br & gt; & quot;, $ textarea ); return the corresponding letter echo & quot; ascii 66 Based on ascii: script ec (2); script
// Truncate the string
Mb_substr ($ str, star, count, encode );
// Obtain the string length
Mb_strlen ();
// Completely retained in the text of textarea.
Str_replace (chr (10 ),"
", $ Textarea );
// Return corresponding letters based on ascii
Echo "the letter with ascii 66 is:". chr (66 )."
";
// Chop removes consecutive spaces and spaces in the string
$ Str = "he llo wo rd"; echo "s :";
Echo "s:". chop ($ str). "w ";
// Explode splits the string by a character and returns an array
$ Str = "green, red, yellow, white ";
$ Arr = explode ("", $ str); echo "the split array is :";
Print_r ($ arr );
// Implode concatenates an array into a string based on a specific character
$ Arr = array ("a", "B", "c", "d ");
$ Str = implode ('/', $ arr );
Echo"
The concatenated string is: ". $ str;
// Print
Print ("print method ");
Echo "formatting printf:
";
Printf ("% f %", 2, "d ");
// Case-insensitive comparison string
Echo "Case Insensitive:". strcasecmp ("hello word", "hello word ");
// Case sensitive
Echo "case sensitive:". strcmp ("hello word", "hello word ");
// Search for strings
Echo "the search result is:". strchr ("hello word", "hello ");
// String Length
Echo "str length:". strlen ("hello word ");
// Repeat the string several times
Echo "repeat the string several times:". str_repeat ("ws", 3 );
// Sort strings in reverse order
Echo "zifuchuandaoxu:". strrev ("zifuchuandaoxu ");
// Converts strings in upper case and lower case
// Strtolower ();
// Strtoupper ();
// String replacement,
Echo "The replaced string is:". str_replace ("B", "*", "aaaaaaabbbbbccccc ");
// Cut string
Echo "the cut string is:". substr ("hello word", 2, 3 );