eval是什么,相信很多都会知道。但真实有多少人使用它呢?恐怕在实际应用中,使用的也比较少吧。(详细请看全文)
Evaluates the string given in code_str as PHP code. Among other things, this can be useful for storing code in a database text field for later execution.
There are some factors to keep in mind when using eval(). Remember that the string passed must be valid PHP code, including things like terminating statements with a semicolon so the parser doesn't die on the line after the eval(), and properly escaping things in code_str. To mix HTML output and PHP code you can use a closing PHP tag to leave PHP mode.
Also remember that variables given values under eval() will retain these values in the main script afterwards.
» 阅读全文
在PHP里面,要想统计一个action或者一个函数或者某个过程的执行所消耗的时间往往都只有一个办法:在运算前记录下时间戳,在运算后记录下时间戳,然后相减,就能得到一个相对比较实际的时间。
基本代码如下(从phpmyadmin里复制而来,懒得打了。这段代码其实也就是phpMyadmin里SQL的执行时间的计算):
PHP代码
- <?php
-
-
- $querytime_before = array_sum(explode(' ', microtime()));
-
- $result = @PMA_DBI_try_query($full_sql_query, null, PMA_DBI_QUERY_STORE);
-
- $querytime_after = array_sum(explode(' ', microtime()));
-
- $GLOBALS['querytime'] = $querytime_after - $querytime_before;
-
- ?>
其中 array_sum(explode(' ', microtime())); 是PHP4时代的写法,到PHP5之后,microtime函数多了一个bool值的参数,加上这个参数后可以直接得到 array_sum(explode(' ', microtime())); 相等的值,即:microtime(true);
本文并无技术含量,纯粹用来记录一下。
随着大盘天天下跌,为了全国苍生,不得己跨入股市拯救世界和平啊。。
“等等,小兄弟,哇,你有一道灵光从天灵盖喷出来啊!小小年纪竟然就有一副横练的筋骨,真是百年难得一遇的武学奇才。我这里有本秘笈,见你这么投缘,十块钱卖给你,以后维护世界和平,警恶惩奸的任务就交给你了,好吗”
今天去参加了一个朋友的婚礼。才发现周围的人一个个的都步入了婚姻的殿堂。当然,我也是其中的一员了。
单身的人越来越少了。
发贴纪念世界上又少了一个贵族。围城里又多了一个方鸿渐。