精品一区二区中文在线,无遮挡h肉动漫在线观看,国产99视频精品免视看9,成全免费高清大全

PHP面試題附答案

時間:2024-08-17 10:36:10 資料大全 我要投稿
  • 相關推薦

PHP面試題附答案

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

PHP面試題附答案

  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(): 本函數對數組的值進行排序,

PHP面試題附答案

。當本函數結束時數組單元將被從最低到最高重新安排,array 中的單元賦予新的鍵名。這將刪除原有的鍵名而不僅是重新排序。

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

  ksort(): 對數組按照鍵名排序,保留鍵名到數據的關聯。本函數主要用于關聯數組。

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

  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;

  9. How would you declare a class named “myclass” with no methods or properties?

  class myclass{

  }

  10. How would you create an object, which is an instance of “myclass”?

  $myoject = new myclass();

  11. How do you access and set properties of a class from within the class?

  getVar() or setVar() ;

  12. What is the difference between include & include_once? include & require?

  require:PHP 程式在執行前,就會先讀入 require 所指定引入的檔案,使它變成 PHP 程式網頁的一部份,

資料共享平臺

PHP面試題附答案》(http://salifelink.com)。常用的函式,亦可以這個方法將它引入網頁中。錯誤產生致命錯誤。

  include:這個函式一般是放在流程控制的處理區段中。PHP 程式網頁在讀到 include 的檔案時,才將它讀進來。這種方式,可以把程式執行時的流程簡單化。錯誤產生警報。

  include_once:此行為和include()語句類似,唯一區別是如果該文件中的代碼已經被包含了,則不會再次包含。如同此語句名字暗示的那樣,只會包含一次。

  13. What function would you use to redirect the browser to a new page?

  1. redir()

【PHP面試題附答案】相關文章:

最新PHP筆試題目及答案05-25

銀行面試題目及答案09-19

益智成語猜謎附答案大全10-10

精彩元宵節燈謎附答案05-28

元宵燈謎大全附答案(成語篇)09-09

常見英文面試問題大全(附答案)06-20

元宵節地名類燈謎大全【附答案】09-15

100個面試常見問題及答案【附解析】08-08

會計類面試題(含答案)06-23

騰訊WEB前端筆試題和面試題答案10-09