首頁  >  文章  >  php教程  >  declare測試

declare測試

WBOY
WBOY原創
2016-08-04 08:54:491606瀏覽

無詳細內容無?php function profile($dump = FALSE){ static $profile; if($dump){ $temp = $profile;//銷毀該指針unset ($profile); return ($temp); } //目前時間戳$profile[] = microtime(); }//declare定義的要執行的函數register_tick_function("pro

<?php
    function profile($dump = FALSE){
        static $profile;

        if($dump){
            $temp = $profile;
//销毁该指针
            unset ($profile);
            return ($temp);
        }
//当前时间戳
        $profile[] = microtime();
    }
//declare定义的要运行的函数
    register_tick_function("profile");

    profile();
 
//每运行两行代码执行一次  register_tick_function("profile");注册的函数。
    declare(ticks=2){
        for($x = 1; $x < 50; $x++){
            //计算两个数组的相似度--递归比较慢的操作
            echo similar_text(md5($x), md5($x * $x)), "<br />";
        }
    }

    print_r(profile (TRUE));
?>
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn