php函數小結2014.10.19

來源:互聯網
上載者:User

標籤:格林威治   count   紀元   

1、count()別名sizeof():計算數組中的單元數目或對象中的屬性個數

      <?php
          $food = array( ‘fruits‘ => array( ‘orange‘ , ‘banana‘ , ‘apple‘ ),
                         ‘veggie‘ => array( ‘carrot‘ , ‘collard‘ , ‘pea‘ ));

          // recursive count
          echo count ( $food , COUNT_RECURSIVE ); // output 8

         // normal count
         echo count ( $food ); // output 2

      ?> 

2、time():返回自從 Unix 紀元(格林威治時間 1970 年 1 月 1 日 00:00:00)到目前時間的秒數

3、mt_rand() :選擇性參數 min 和     max mt_rand() 返回 0 到 mt_getrandmax() 之間的偽隨機數 mt_rand(5, 15)

4、mt_getrandmax() : 返回調用 mt_rand() 所能返回的最大的隨機數

5、move_upload_file():將上傳的檔案移動到新位置 

6、explode(‘?‘,$str):用?分割字串

7、pathinfo();

     <?php
         $path_parts = pathinfo ( ‘/www/htdocs/inc/lib.inc.php‘ );

         echo $path_parts [ ‘dirname‘ ], "\n" ;
         echo $path_parts [ ‘basename‘ ], "\n" ;
         echo $path_parts [ ‘extension‘ ], "\n" ;
         echo $path_parts [ ‘filename‘ ], "\n" ;
    ?> 

    輸出:

       /www/htdocs/inc       lib.inc.php       php       lib.inc8、unipid():       uniqid ([  string $prefix  = ""    [,  bool $more_entropy  = false   ]] )       擷取一個帶首碼、基於目前時間微秒數的唯一ID


本文出自 “AidanDai” 部落格,請務必保留此出處http://562097645.blog.51cto.com/9361855/1566103

php函數小結2014.10.19

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.