Basic php Functions
The following is an example:
<? Php // generate random numbers and time functions // echo rand (); // echo "<br>"; // echo rand (); // echo time (); // timestamp // 2017-02-10 08: 46: 12date_default_timezone_set ("Asia/Shanghai"); // echo date ("Y-m-d h: I: s "); // The current time is converted by default. // echo date ("Y-m-d h: I: s", '000000'); // echo strtotime ("1386688343 11:12:23 "); // string processing $ str = 'Hello World !!! '; // Echo strlen ($ str); // $ str1 = 'abc'; // $ str2 = 'abc'; // echo strcmp ($ str1, $ str2); // echo strcasecmp ($ str1, $ str2); echo strtoupper ($ str2); echo strtolower ($ str1 ); // $ str = "a | B | c | d"; // $ str1 = explode ("|", $ str); // echo implode ("&", $ str1); // echo substr ($ str, 1, 3); // echo str_replace ("|", "&", $ str); // echo substr_replace ($ str, "%", 1, 1); $ str = "hello3 world4 ashdf223sdfa2323sd45454"; // preg_match ("/\ d/", $ str, $ str2 ); // preg_match_all ("/\ d/", $ str, $ str3); // var_dump ($ str3); // $ str4 = preg_replace ("/\ d /", "Number", $ str); // var_dump ($ str4); $ str5 = preg_split ("/\ d/", $ str); var_dump ($ str5 );
The above is all the content of this article. I hope this article will help you in your study or work. I also hope to provide more support to the customer's home!