日韩欧美另类久久久精品_亚洲大色堂人在线无码_国产三级aⅴ在线播放_在线无码aⅴ精品动漫_国产精品精品国产专区

2015最新PHP面試題附答案

  1. Which of the following will not add john to the users array?

  1. $users[] = ‘john’;

  2. array_add($users,’john’);

  3. array_push($users,’john’);

  4. $users ||= ‘john’;

  Answer: 2,4

  2. What’s the difference between sort(), asort() and ksort(),rsort()? Under what circumstances would you use each of these?

  sort(): 本函數(shù)對數(shù)組的值進(jìn)行排序。當(dāng)本函數(shù)結(jié)束時數(shù)組單元將被從最低到最高重新安排,array 中的單元賦予新的鍵名。這將刪除原有的鍵名而不僅是重新排序。

  asort(): 這個函數(shù)將數(shù)組的值重新排序,由小至大排列。數(shù)組的索引亦跟著值的 順序而變動。當(dāng)您在程序中需要重新整理數(shù)組值的 順序時,就可以使用這個函數(shù)。

  ksort(): 對數(shù)組按照鍵名排序,保留鍵名到數(shù)據(jù)的關(guān)聯(lián)。本函數(shù)主要用于關(guān)聯(lián)數(shù)組。

  rsort(): 本函數(shù)對數(shù)組進(jìn)行逆向排序(最高到最低)。與sort()執(zhí)行相反的操作。

  3. What would the following code print to the browser? Why?

  $num = 10;

  function multiply(){

  $num = $num * 10;

  }

  multiply();

  echo $num;

  10

  4. What is the difference between a reference and a regular variable? How do you pass by reference & why would you want to?

  pass by reference like this functions(&$vars);

  it likes more fast;

  5. What functions can you use to add library code to the currently running script?

  inlcude() or require();

  6. What is the difference between foo() & @foo()?

  if foo() throw a error, will be alert, but @foo() no;

  7. How do you debug a PHP application?

  xdebug or use die() do it;

  8. What does === do? What’s an example of something that will give true for ‘==’, but not ‘===’?

  === 用于精確比較 ex: (” == null) => true but ( ”===null) =>false;

本文已影響6827
上一篇:Yahoo-PHP面試筆試題分享 下一篇:一套比較完整的PHP的筆試題

相關(guān)文章推薦

|||||