- 相關(guān)推薦
幾道PHP筆試題
1. 如何用php的環(huán)境變量得到一個網(wǎng)頁地址的內(nèi)容?ip地址又要怎樣得到?
2. 求兩個日期的差數(shù),例如2007-2-5 ~ 2007-3-6 的日期差數(shù)
3. 請寫一個函數(shù),實現(xiàn)以下功能:
字符串“open_door” 轉(zhuǎn)換成 “OpenDoor”、”make_by_id” 轉(zhuǎn)換成 ”MakeById”,
幾道PHP筆試題
。4. 要求寫一段程序,實現(xiàn)以下數(shù)組$arr1轉(zhuǎn)換成數(shù)組$arr2:
$arr1 = array (
’0′ => array (‘fid’ => 1, ‘tid’ => 1, ‘name’ =>’Name1′ ),
’1′ => array (‘fid’ => 1, ‘tid’ => 2 , ‘name’ =>’Name2′ ),
’2′ => array (‘fid’ => 1, ‘tid’ => 5 , ‘name’ =>’Name3′ ),
’3′ => array (‘fid’ => 1, ‘tid’ => 7 , ‘name’ =>’Name4′ ),
’4′ => array (‘fid’ => 3, ‘tid’ => 9, ‘name’ =>’Name5′ )
);
$arr2 = array (
’0′ => array (
’0′ => array ( ‘tid’ => 1, ‘name’ => ‘Name1′),
’1′ => array ( ‘tid’ => 2, ‘name’ => ‘Name2′),
’2′ => array ( ‘tid’ => 5, ‘name’ => ‘Name3′),
’3′ => array ( ‘tid’ => 7, ‘name’ => ‘Name4′)
),
’1′ => array (
’0′ => array ( ‘tid’ => 9, ‘name’ => ‘Name5′ )
)
);
5. 請簡述數(shù)據(jù)庫設(shè)計的范式及應(yīng)用,
資料共享平臺
《幾道PHP筆試題》(http://www.lotusphilosophies.com)。一般第3范式就足以,用于表結(jié)構(gòu)的優(yōu)化,這樣做既可以避免應(yīng)用程序過于復(fù)雜同時也避免了SQL語句過于龐大所造成系統(tǒng)效率低下。
6.一個表中的Id有多個記錄,把所有這個id的記錄查出來,并顯示共有多少條記錄數(shù),用SQL語句及視圖、存儲過程分別實現(xiàn)。
DELIMITER //
CREATE PROCEDURE ProcGet
(
IN ID_a INT(11)
)
BEGIN
DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN END;
SELECT COUNT(*) AS Sum FROM News Where ID = ID_a;
END;//
CALL ProcGet(88)//
7 表中有A B C三列,用SQL語句實現(xiàn):當(dāng)A列大于B列時選擇A列否則選擇B列,當(dāng)B列大于C列時選擇B列否則選擇C列。
DELIMITER //
CREATE PROCEDURE ProcOut()
BEGIN
DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN END;
DECLARE Sum_a INT(11);
DECLARE Sum_b INT(11);
DECLARE Sum_c INT(11);
– 獲取A列中的總值 <–
DECLARE cur_1 CURSOR FOR SELECT SUM(A) FROM table_name;
OPEN cur_1;
FETCH cur_ 1 INTO Sum_a;
CLOSE cur_1;
– 獲取B列中的總值 <–
DECLARE cur_2 CURSOR FOR SELECT SUM(B) FROM table_name;
OPEN cur_2;
FETCH cur_ 2 INTO Sum_b;
CLOSE cur_2;
– 獲取C列中的總值 <–
DECLARE cur_3 CURSOR FOR SELECT SUM(C) FROM table_name;
OPEN cur_3;
FETCH cur_ 3 INTO Sum_c;
CLOSE cur_3;
IF Sum_a > Sum_b THEN
SELECT A FROM table_name;
ELSEIF Sum_b > Sum_c THEN
SELECT B FROM table_name;
【幾道PHP筆試題】相關(guān)文章:
經(jīng)典PHP筆試題09-16
最新php筆試試題10-27
最新PHP筆試題目及答案05-25
筆美國國家儀器試題目09-23
新浪筆經(jīng)04-27
Php程序員崗位職責(zé)范本08-20
新聞總署筆經(jīng)10-13
IBM公司筆經(jīng)09-15
營銷卷筆經(jīng)10-25