Php knowledge point review string

Source: Internet
Author: User
These are all hard work. remember to look back !!! /* Echo & lt; markqqqqqq \ nqqqqqq & lt; br & gt; qqqqqqqqqqqqqqq \ rqqqqqqqqqqqqqqqqqqqqqqmark * // A new line of technical mark is required and written in the top level! // The role is similar to & quot; // The most fatal one. these can be hard-pressed. remember to look back !!!
 
/* Echo <mark
Qqqqqq \ nqqqqqq
Qqqqqqqqqqqqqqq \ rqqqqqqqqqqqqqqqqqqqqqq
Mark */
// The technical mark should be set to another line and written in the top level!
// Similar ""
// The most fatal point is that a mark cannot be followed by any symbols, that is, it must be used at the end of the code.
 
 
 
 
 
 
$ A = "aaaaaaaaaa ";
$ B = "bbbbbbbbbbbb ";
$ C = print ($ );
 
 
Echo"
";
Echo $ c;
Echo"
";
Echo $ a, $ B;
 
 
// 5b binary format; % c ASCII format
$ Format = "% B, % c ";
Printf ($ format, 100,200 );
Echo sprintf ($ format, 100,200 );
Echo"
";
 
 
 
 
$ Str = "abcdefghijklmnopqrstyvwxyz ";
$ Width = 4;
$ Break = "\ t ";
Echo wordwrap ($ str, $ width, $ break, true );
 
 
/* Strtoupper ();
Strtolower ();
Ucwords ();*/
 
 
// Strlen ()
// The space in the string is also counted as one.
 
 
// Use substr_count (string str, string sub, [int start, int length ])
$ Words = "ran zhang li ni ran ";
$ Handle = "ran ";
$ Count = substr_count ($ words, $ handle );
Echo $ count;
 
 
 
 
// Mixed str_word_count (string $ str, [int format, string $ child]);
// Format 0: default value. The number of returned words.
// 1: returns an array of words. The key is the index value.
// 2: returns an array of words. The key is the position of the first letter of the word.
 
 
 
 
// Search for substrings
$ A1 = "aaaaaabdddddd ";
$ A2 = "B ";
$ A3 = strstr ($ a1, $ a2 );
Echo $ a3;
// Output bdddddd
 
 
 
 
// Location search. the returned location is almost the same as above.
// Int strpos (string $ a, string B, [int offset]);
 
 
 
 
 
 
// String replication
Echo"
";
$ Input = "zhangran ";
$ Number = 10;
$ Str = str_repeat ($ input, $ number );
Echo $ str;
 
 
 
 
// Reverse string
Echo"
";
$ A4 = strrev ("abc ");
Echo $ a4;
 
 
 
 
// Replace
// Substr_replace (mixed $ string, string $ replacement, int $ start, [int $ length])
 
 
 
 
// Split
Echo"
";
$ A5 = "hello, world, I, am, the, only, one ";
$ Separator = ",";
$ A7 = 3;
$ Array = explode ($ separator, $ a5, $ a7 );
Print_r ($ array );
 
 
Echo"
";
$ A8 = "qqqqqqqqqqqqqqqqqqqq ";
$ A9 = 4;
$ B3 = str_split ($ a8, $ a9 );
Print_r ($ b3 );
// If it cannot be sorted out first
 
 
 
// Merge
Echo"
";
$ B4 = array ("aaa", "bbb", "ccc ");
$ B5 = ",";
Echo implode ($ b5, $ b4 );
 
 
// String comparison
// Int strcmp (str1, str2) which is completely compared
 
 
// Strncmp (str1, str2, len) checks whether the first len strings of the two strings are equal.

Column by kaituozhe345
Related Article

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.