ホームページ >バックエンド開発 >PHPチュートリアル >PHP ソフトウェア エンジニアのインタビュー共有
PHP プログラマーのインタビュー共有
インタビューの概要
今日、私は PHP プログラマーの面接のために北京の有名な IT 企業に行きました。人生で初めてなんで緊張しないの? 私は病気ですか?いいえ、これを自信といいます。
まず、筆記試験の問題をいくつかやってください。私の答えは、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用紙1枚にたくさんの問題が載っています。
これでは、もっと簡単に書く必要がありませんか?しかし、私はまだいくつかの愚かな間違いを犯しました。それを修正しようとしています。
ちょっとしたメリットをみんなと共有します。
ご多幸をお祈りします。