亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 670810 | 回復: 456
打印 上一主題 下一主題

PHP工程師筆試題匯總 [復制鏈接]

論壇徽章:
0
跳轉到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2011-01-27 21:16 |只看該作者 |倒序瀏覽
騰訊PHP工程師筆試題
騰訊PHP工程師筆試題.rar (2.89 KB, 下載次數(shù): 1327)
新浪php工程師的面試題(編程部分)
游客,如果您要查看本帖隱藏內容請回復

Yahoo! PHP 筆試題
游客,如果您要查看本帖隱藏內容請回復



騰訊PHP工程師筆試題
1. 請對POSIX風格和兼容Perl風格兩種正則表達式的主要函數(shù)進行類比說明
ereg preg_match
ereg_replace preg_replace


2. 請說明在php.ini中safe_mode開啟之后對于PHP系統(tǒng)函數(shù)的影響


3. PHP5中魔術方法函數(shù)有哪幾個,請舉例說明各自的用法

__sleep
__wakeup
__toString
__set_state
__construct,
__destruct
__call,
__get,
__set,
__isset,
__unset
__sleep,
__wakeup,
__toString,
__set_state,
__clone
__autoload


4. 請寫出讓,并說明如何在命令行下運行PHP腳本(寫出兩種方式)同時向PHP腳本傳遞參數(shù)?


5. PHP的垃圾收集機制是怎樣的


6.使對象可以像數(shù)組一樣進行foreach循環(huán),要求屬性必須是私有。
(Iterator模式的PHP5實現(xiàn),寫一類實現(xiàn)Iterator接口)


7.請寫一段PHP代碼,確保多個進程同時寫入同一個文件成功


8. 用PHP實現(xiàn)一個雙向隊列


9. 使用正則表達式提取一段標識語言(html或xml)代碼段中指定標簽的指定屬性值(需考慮屬性值對不規(guī)則的情況,如大小寫不敏感,屬性名值與等號間有空格等)。此處假設需提取test標簽的attr屬性值,請自行構建包含該標簽的串

<test attr=”ddd”>

<test attr\s*=\s*[“ ¦’](.*?)[” ¦’].*?>


10.請使用socket相關函數(shù)(非curl)實現(xiàn)如下功能:構造一個post請求,發(fā)送到指定http server的指定端口的指定請求路徑(如http://www.example.com:8080/test)。請求中包含以下變量:
用戶名(username):溫柔一刀
密碼(pwd):&123=321&321=123&
個人簡介(intro):Hello world!

且該http server需要以下cookie來進行簡單的用戶動作跟蹤:

cur_query:you&me
last_tm:...(上次請求的unix時間戳,定為當前請求時間前10分鐘)
cur_tm:...(當前請求的unix時間戳)
設置超時為10秒,發(fā)出請求后,將http server的響應內容輸出。
1.
Function encode($data, $sep = ‘&’){
2.
while (list($k,$v) = each($data)) {
3.
$encoded .= ($encoded ? "$sep" : "";
4.
$encoded .= rawurlencode($k)."=".rawurlencode($v);
5.
}
6.
Return $encoded;
7.
}
8.

9.
Function post($url, $post, $cookie){
10.
$url = parse_url($url);
11.
$post = encode($data, ‘&’);
12.
$cookie = encode($cookieArray, ‘;’);
13.
$fp = fsockopen($url['host'], $url['port'] ? $url['port'] : 80, $errno, $errstr, 10);
14.
if (!$fp) return "Failed to open socket to $url[host]";
15.

16.
fputs($fp, sprintf("OST %s%s%s HTTP/1.0\n", $url['path'], $url['query'] ? "?" : "", $url['query']));
17.
fputs($fp, "Host: $url[host]\n";
18.
fputs($fp, "Content-type: application/x-www-form-urlencoded\n";
19.
fputs($fp, "Content-length: " . strlen($encoded) . "\n";
20.
fputs($fp, "Cookie: $cookie\n\n";
21.
fputs($fp, "Connection: close\n\n";
22.
fputs($fp, "$post \n";
23.

24.
while (!feof($fp)) {
25.
echo fgets($fp, 12;
26.
}
27.
fclose($fp);
28.
}
29.

30.
$url = ‘http://www.example.com:8080/test’;
31.
$encoded = username=溫柔一刀& pwd=
32.
$post = array(
33.
‘username’=> ‘溫柔一刀’,
34.
‘pwd => ‘&123=321&321=123&’,
35.
‘intro => ‘Hello world!’
36.
);
37.
$cookie = array(
38.
‘cur_query’ => ‘you&me,
39.
‘last_tm’ => time() - 600,
40.
‘cur_tm ‘=> time()
41.
);
42.

43.
Post($url, $post, $cookie);
復制代碼
11.你用什么方法檢查PHP腳本的執(zhí)行效率(通常是腳本執(zhí)行時間)和數(shù)據(jù)庫SQL的效率(通常是數(shù)據(jù)庫Query時間),并定位和分析腳本執(zhí)行和數(shù)據(jù)庫查詢的瓶頸所在?
1.腳本執(zhí)行時間,啟用xdebug,使用WinCacheGrind分析。
2.數(shù)據(jù)庫查詢,mysql使用EXPLAIN分析查詢,啟用slow query log記錄慢查詢。


PHP LAMP Engineer Test Paper
Question 1
What does <? echo count ("123" ?> 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\n", 42);
B) printf("%1.2f\n", 42);
C) printf("%1.2u\n", 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?
<?php
$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?
<?php
function timesTwo($int) {
$int = $int * 2;
}
$int = 2;
$result = timesTwo($int);
?>;
Answer: NULL
Question 6
The code below ___________ because ____________.
<?php
class Foo {
?>
<?php
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:
<?php
echo count(strlen("http://php.net");
?>
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

論壇徽章:
0
2 [報告]
發(fā)表于 2011-01-27 22:13 |只看該作者

論壇徽章:
0
3 [報告]
發(fā)表于 2011-01-28 02:27 |只看該作者

論壇徽章:
0
4 [報告]
發(fā)表于 2011-01-28 10:03 |只看該作者
狗日的,出點實用的行不

論壇徽章:
0
5 [報告]
發(fā)表于 2011-01-28 10:25 |只看該作者
學習

論壇徽章:
0
6 [報告]
發(fā)表于 2011-01-28 14:55 |只看該作者
看了TX的,我是肯定沒戲了!

論壇徽章:
13
CU大;照
日期:2013-03-14 14:14:082016科比退役紀念章
日期:2016-07-22 11:15:35數(shù)據(jù)庫技術版塊每日發(fā)帖之星
日期:2016-05-27 06:20:002015亞冠之吉達阿赫利
日期:2015-08-05 10:06:542015年亞洲杯之韓國
日期:2015-04-01 16:05:42雙魚座
日期:2014-11-13 11:04:24丑牛
日期:2014-07-25 17:29:54子鼠
日期:2014-04-25 12:25:45丑牛
日期:2014-04-17 08:35:48巨蟹座
日期:2014-04-16 16:50:05CU大;照
日期:2013-03-14 14:14:29CU大;照
日期:2013-03-14 14:14:26
7 [報告]
發(fā)表于 2011-01-31 21:09 |只看該作者
看看

論壇徽章:
0
8 [報告]
發(fā)表于 2011-02-01 09:35 |只看該作者

論壇徽章:
0
9 [報告]
發(fā)表于 2011-02-01 14:28 |只看該作者
好東西呀

論壇徽章:
0
10 [報告]
發(fā)表于 2011-02-10 08:51 |只看該作者
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復

  

北京盛拓優(yōu)訊信息技術有限公司. 版權所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關心和支持過ChinaUnix的朋友們 轉載本站內容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP