騰訊PHP筆試?
1. 請對POSIX風格和兼容Perl風格兩種正則表達式的主要函數進行類比説明
ereg preg_match
ereg_replace preg_replace
2. 請説明在中safe_mode開啟之後對於PHP系統函數的影響
3. PHP5中魔術方法函數有哪幾個,請舉例説明各自的用法
__sleep
__wakeup
__toString
__set_state
__construct,
__destruct
__call,
__get,
__set,
__isset,
__unset
__sleep,
__wakeup,
__toString,
__set_state,
__clone
__autoload
4. 請寫出讓,並説明如何在命令行下運行PHP腳本(寫出兩種方式)同時向PHP腳本傳遞參數?
5. PHP的垃圾收集機制是怎樣的
6.使對象可以像數組一樣進行foreach循環,要求屬性必須是私有。
(Iterator模式的PHP5實現,寫一類實現Iterator接口)
7.請寫一段PHP代碼,確保多個進程同時寫入同一個文件成功
8. 用PHP實現一個雙向隊列
9. 使用正則表達式提取一段標識語言(html或xml)代碼段中指定標籤的指定屬性值(需考慮屬性值對不規則的'情況,如大小寫不敏感,屬性名值與等號間有空格等)。此處假設需提取test標籤的attr屬性值,請自行構建包含該標籤的串
10.請使用socket相關函數(非curl)實現如下功能:構造一個post請求,發送到指定http server的指定端口的指定請求路徑請求中包含以下變量:
用户名(username):温柔一刀
密碼(pwd):&123=321&321=123&
個人簡介(intro):Hello world!
且該http server需要以下cookie來進行簡單的用户動作跟蹤:
cur_query:you&me
last_tm:...(上次請求的unix時間戳,定為當前請求時間前10分鐘)
cur_tm:...(當前請求的unix時間戳)
設置超時為10秒,發出請求後,將http server的響應內容輸出。複製內容到剪貼板代碼:Function encode($data, $sep = ‘&’){
while (list($k,$v) = each($data)) {
$encoded .= ($encoded ? "$sep" : "");
$encoded .= rawurlencode($k)."="rlencode($v);
}
Return $encoded;
}
Function post($url, $post, $cookie){
$url = parse_url($url);
$post = encode($data, ‘&’);
$cookie = encode($cookieArray, ‘;’);
$fp = fsockopen($url[host], $url[port] ? $url[port] : 80, $errno, $errstr, 10);
if (!$fp) return "Failed to open socket to $url[host]";
fputs($fp, sprintf("POST %s%s%s HTTP/1.0", $url[path], $url[query] ? "?" : "", $url[query]));
fputs($fp, "Host: $url[host]");
fputs($fp, "Content-type: application/x-www-form-urlencoded");
fputs($fp, "Content-length: " . strlen($encoded) . "");
fputs($fp, "Cookie: $cookie");
fputs($fp, "Connection: close");
fputs($fp, "$post");
while (!feof($fp)) {
echo fgets($fp, 128);
}
fclose($fp);
}
$url = ‘’;
$encoded = username=温柔一刀& pwd=
$post = array(
‘username’=> ‘温柔一刀’,
‘pwd => ‘&123=321&321=123&’,
‘intro => ‘Hello world!’
);
$cookie = array(
‘cur_query’ => ‘you&me,
‘last_tm’ => time() - 600,
‘cur_tm ‘=> time()
);
Post($url, $post, $cookie);
11.你用什麼方法檢查PHP腳本的執行效率(通常是腳本執行時間)和數據庫SQL的效率(通常是數據庫Query時間),並定位和分析腳本執行和數據庫查詢的瓶頸所在?
1.腳本執行時間,啟用xdebug,使用WinCacheGrind分析。
2.數據庫查詢,mysql使用EXPLAIN分析查詢,啟用slow query log記錄慢查詢。
PHP LAMP Engineer Test Paper
Question 1
What does print out?
A) 3
B) False
C) Null
D) 1
E) 0
Question 2
Which of the following snippets prints a representation of 42 with two decimal places?
A) printf("%.2d", 42);
B) printf("%1.2f", 42);
C) printf("%1.2u", 42);
Question 3
Given
$text = Content-Type: text/xml;
Which of the following prints text/xml?
A) print substr($text, strchr($text, :));
B) print substr($text, strchr($text, :) + 1);
C) print substr($text, strpos($text, :) + 1);
D) print substr($text, strpos($text, :) + 2);
E) print substr($text, 0, strchr($text, :)
Question 4
What is the value of $a?
$a = in_array(01, array(1)) == var_dump(01 == 1);
?>
A) True
B) False
Question 5
What is the value of $result in the following PHP code?
function timesTwo($int) {
$int = $int * 2;
}
$int = 2;
$result = timesTwo($int);
?>;
Answer: NULL
Question 6
The code below ___________ because ____________.
class Foo {
?>
function bar() {
print "bar";
}
}
?>
A) will work, class definitions can be split up into multiple PHP blocks.
B) will not work, class definitions must be in a single PHP block.
C) will not work, class definitions must be in a single file but can be in multiple PHP blocks.
D) will work, class definitions can be split up into multiple files and multiple PHP blocks.
Question 7
When turned on, ____________ will _________ your script with different variables from HTML forms and cookies.
A) show_errors, enable
B) show_errors, show
C) register_globals, enhance
D) register_globals, inject
Question 8
What will be the output of the following PHP code:
echo count(strlen(""));
?>
Answer: 1
Question 9
What is the best all-purpose way of comparing two strings?
A) Using the strpos function
B) Using the == operator
C) Using strcasecmp()
D) Using strcmp()
Question 10
What is the difference between "print()" and "echo()"?
Answer: print is a function,echo is a language construct
相關文章
-
公司面試題之:騰訊PHP工程師筆試題
歌唱發音的有哪些基礎知識,發聲是怎麼練習的?下面要為大家分享的就是唱歌正確發聲訓練方法,希望你會喜歡!唱歌正確發聲訓練方法一、歌唱的生理歌唱作為一項音樂表演活動,是以自已身體的有關器官作為樂器來進行演奏的,歌唱 -
騰訊PHP開發工程師面試試卷
1. 請對pOSIX風格和兼容perl風格兩種正則表達式的主要函數進行類比説明ereg preg_matchereg_replace preg_replace2. 請説明在中safe_mode開啟之後對於pHp系統函數的影響3. pHp5中魔術方法函數有哪幾個,請舉例説明各自 -
ui設計師是否有用過騰訊出的psplay ?
星期天,我閒的沒事幹,就看了一個“雞蛋可以浮起來”的視頻。我有點不信,我就去廚房準備材料。我先去廚房倒了點温水灌入瓶子裏。然後我要把雞蛋放進去,如果這一步做錯了,前面做的就白費了。要把瓶子傾斜一點,再把雞蛋放進去 -
[安卓app]騰訊新聞評測
騰訊新聞是騰訊團隊用心打造的一款豐富、及時的新聞應用,本着精煉、輕便的目標,為用户提供高效、優質的閲讀體驗。全球視野,聚焦中國,一朝在手,博覽天下。用户可隨時隨地掌握最新的資訊信息、最精彩的視覺圖片、最犀利的時 -
騰訊的IP分享計劃是怎麼處理動態IP的?
想讓QQ天氣預報顯示我所在城市的天氣時,發現有一個“騰訊IP分享計劃”和設置用户所在的城市有關。嘗試了幾次,都沒弄成功。觀察了一下我的位置提交記錄,發現我的地理位置提交請求大多被否決。而我的IP地址,貌似也是動態的 -
請多方面闡述下騰訊風鈴搜狐快站百度siteapp的優缺點?
微信應用範圍廣且可支付,騰訊風鈴所創立的微站是否更適合小商家推廣?我想用搜狐,但是又怕不好推廣。風鈴,siteapp,搜狐快站 對中小商户來説只是提供適合移動端閲讀內容的工具。現在看來風鈴雖然是騰訊系產品,但是微信並沒有 -
安卓APP騰訊視頻全面解析介紹測評
許多人喜歡看視頻,可是有時候用電腦不方便看或者是手頭沒有電腦的時候,怎麼辦呢?因此,有人就會下載騰訊的視頻手機軟件來看視頻。這款手機視頻軟件到底如何呢?今天,我們一起來看看測評的結果吧。工具/原料安卓系統手機 騰訊 -
騰訊為什麼給iphone4特殊待遇,你的好友正在使用iphoneqq等等
如題,騰訊為什麼給iphone4特殊待遇,你的好友正在使用iphoneqq等等 -
關於國內著名互聯網企業PHP筆試試題
國內著名互聯網企業pHp筆試題面對目前全球金融危機,國內動盪的互聯網環境,那冬天就要到來,大家也在積極的尋找一個過冬的窩,所以估計辭職跳槽的人很多,特別為大家分享一些各個著名公司的pHp筆試題,為大家求職就業打好堅實基 -
如何利用騰訊QQ雲查看PPT文件(這個值得有)!
也許我們為了計算機的純淨或重裝系統時省時方便,我們會試着儘量少裝一些不太用得着的軟件。可是我們又不可避免的會在工作中遇到需要查看審閲的'數字文檔,那麼我們怎樣來通過別的途徑打開查看它呢?工具/原料騰訊QQ2013