One, random number and time
Random number generator (JS:math.random)
echo rand ();
Generate a random number in a range
echo rand (0,10);
Time stamp
echo Time ();
Format the display of time
echo "<br>";
echo Date ("Y-m-d h:i:s", Time ());
echo "<br>";
echo Date ("Y-m-d h:i:s", "101506494366");
Convert String to Timestamp
echo "<br>";
Echo strtotime ("2017-09-27 14:49:13");
echo "<br>";
Second, String function
Length Str.length
$str 1 = "ABCDEFG";
$str 2 = "ABCD";
Echo strlen ($str 1);
Comparison of two string lengths
echo "<br>";
Var_dump (strcmp ($str 1, $str 2));
Turn lowercase
echo "<br>";
Echo strtolower ("ABCDE");
Turn capital
echo "<br>";
Strtoupper ();
Splits a string, returns an array
echo "<br>";
Var_dump (Explode ("B", $str 2));
Stitching array elements into a single string
echo "<br>";
echo Implode ("|", ["a", "B", "C"]);
Find replacements
echo "<br>";
Echo str_replace ("CD", "CD", $str 1);
Replace the specified position character
echo "<br>";
Echo Substr_replace ($str 1, "xxx", 0, 3);
Intercept string
echo "<br>";
Echo substr ($str 1,1,3);
PHP Basics (ii) 1, random number and time 2, String function