php 基礎函數詳解

來源:互聯網
上載者:User
本篇文章主要介紹php 基礎函數詳解,感興趣的朋友參考下,希望對大家有所協助。

話不多說,如下所示:

<?php//產生隨機數 和 時間函數//echo rand();//echo "<br>";//echo rand(0,10);//echo time();//時間戳記//2017-02-10 08:46:12date_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,1);$str = "hello3 world4 ashdf223sdfa2323sd45454";//preg_match("/\d/",$str,$str2);//preg_match_all("/\d/",$str,$str3);//var_dump($str3);//$str4 = preg_replace("/\d/", "數字", $str);//var_dump($str4);$str5 = preg_split("/\d/",$str);var_dump($str5);

以上就是本文的全部內容,希望對大家的學習有所協助。


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.