话不多说,如下所示:
PHP;">
PHP
//生成随机数 和 时间函数
//echo rand();
//echo "
"; //echo rand(0,10); //echo time();//时间戳 //2017-02-10 08:46:12 date_default_timezone_set("Asia/Shanghai"); //echo date("Y-m-d h:i:s");//默认转换当前时间 //echo date("Y-m-d h:i:s",'1386688343'); //echo strtotime("2013-12-10 11:12:23"); //字符串的处理 $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); $str = "hello3 world4 ashdf223sdfa2323sd45454"; //preg_match("/\d/",$str,$str2); //preg_match_all("/\d/",$str3); //var_dump($str3); //$str4 = preg_replace("/\d/","数字",$str); //var_dump($str4); $str5 = preg_split("/\d/",$str); var_dump($str5);
原文链接:https://www.f2er.com/php/17977.html"; //echo rand(0,10); //echo time();//时间戳 //2017-02-10 08:46:12 date_default_timezone_set("Asia/Shanghai"); //echo date("Y-m-d h:i:s");//默认转换当前时间 //echo date("Y-m-d h:i:s",'1386688343'); //echo strtotime("2013-12-10 11:12:23"); //字符串的处理 $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); $str = "hello3 world4 ashdf223sdfa2323sd45454"; //preg_match("/\d/",$str,$str2); //preg_match_all("/\d/",$str3); //var_dump($str3); //$str4 = preg_replace("/\d/","数字",$str); //var_dump($str4); $str5 = preg_split("/\d/",$str); var_dump($str5);