发布时间:2015-05-27 19:20:31作者:知识屋
今天去了北京著名IT公司进行PHP程序员的面试。这是人生第一次么,怎么不紧张?我是不是有病。不是,这叫自信呵.
首先是做一些笔试题。我的答案是:使用stripos()这个函数来解决的。
if(stripos($a,$b)>-1) echo "b in a";else echo "b not in a";
拓展:
$b_arr = str_split($b);for(var $i=0,$len = count($b_arr); $i < $len ; ++$i){ if(stripos($a,$b_arr[$i])==-1) return false; return true;}
class Timer { private $StartTime = 0;//程序运行开始时间 private $StopTime = 0;//程序运行结束时间 private $TimeSpent = 0;//程序运行花费时间 function start(){//程序运行开始 $this->StartTime = microtime(); } function stop(){//程序运行结束 $this->StopTime = microtime(); } function spent(){//程序运行花费的时间 if ($this->TimeSpent) { return $this->TimeSpent; } else { list($StartMicro, $StartSecond) = explode(" ", $this->StartTime); list($StopMicro, $StopSecond) = explode(" ", $this->StopTime); $start = doubleval($StartMicro) + $StartSecond; $stop = doubleval($StopMicro) + $StopSecond; $this->TimeSpent = $stop - $start; return substr($this->TimeSpent,0,8)."秒";//返回获取到的程序运行时间差 } } } $timer = new Timer(); $timer->start(); //...程序运行的代码 $timer->stop(); echo "程序运行时间为:".$timer->spent();
下面是简单版的。
class Timer{ private $t = 0; public function start(){ $this->t = microtime(true); } public function stop(){ return microtime(true)- $this->t; }}$time = new Timer();$time->start();//do somethings...$t = $time->stop();
create table url( `id` int(11) not null primary key auto_increment comment "主键", `url` varchar(255) not null comment "url 内容", `name` varchar(50) comment "url对应的名称")ENGINE=MyISAM
不是我想简单写啊。这么多题目就一张A4纸啊。
这不是逼着我写简单点吗?不过我还是犯了一些低级的错误。我正在努力改正。
一点福利,分享给大家。
Best Wishes.
如何对PHP文件进行加密方法 PHP实现加密的几种方式介绍
php生成圆角图片的方法 电脑中php怎么生成圆角图片教程
用PHP构建一个留言本方法步骤 php怎么实现留言板功能
php中三元运算符用法 php中的三元运算符使用说明
php文件如何怎么打开方式介绍 php文件用什么打开方法
PHP怎么插入数据库方法步骤 php编程怎么导入数据库教程
如何安装PHPstorm并配置方法教程 phpstorm安装后要进行哪些配置
PHP 获取远程文件大小的3种解决方法 如何用PHP获取远程大文件的大小
20个实用PHP实例代码 php接口开发实例代码详细介绍
如何架设PHP服务器方法步骤 怎么搭建php服务器简单教程