19c03-2.php

来自「介绍PHP5的给类型函数应用」· PHP 代码 · 共 44 行

PHP
44
字号
<?php// Let's test our timing functionality, first include the file://require 'timer.php';require '19c03-1.php';// Let's generate a hundred thousand random numbersforeach(range(1,100000) as $r) {	rand();}// Now check how long that took._timer();// Generate one SHA hash, based upon the last generated number:sha1($r);// Did that take very long?_timer();// Let's create a function that will do some work for us:function do_it() {	// Immediately start a timer	_timer();		// Now just sleep for 3 seconds	sleep(3);}// Now call the function:do_it();// Then time one last time:_timer();// Now generate the text results, and output them - Will be similar to:// Timing Results// 0.00000 secs - File: 19c03-1.php - Line: 28 - Calling Function: require// 0.24862 secs - File: 19c03-2.php - Line: 12// 0.00011 secs - File: 19c03-2.php - Line: 18// 0.00005 secs - File: 19c03-2.php - Line: 23 - Calling Function: do_it// 2.98948 secs - File: 19c03-2.php - Line: 33$output = _timer_text();echo "<pre>{$output}</pre>\n";?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?