久久久久无码精品,四川省少妇一级毛片,老老熟妇xxxxhd,人妻无码少妇一区二区

PHP面試題附答案

時(shí)間:2023-04-05 10:18:10 筆試題目 我要投稿
  • 相關(guān)推薦

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

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

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

  rsort(): 本函數(shù)對(duì)數(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;

  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 程式在執(zhí)行前,就會(huì)先讀入 require 所指定引入的檔案,使它變成 PHP 程式網(wǎng)頁(yè)的一部份。常用的函式,亦可以這個(gè)方法將它引入網(wǎng)頁(yè)中。錯(cuò)誤產(chǎn)生致命錯(cuò)誤。

  include:這個(gè)函式一般是放在流程控制的處理區(qū)段中。PHP 程式網(wǎng)頁(yè)在讀到 include 的檔案時(shí),才將它讀進(jìn)來(lái)。這種方式,可以把程式執(zhí)行時(shí)的流程簡(jiǎn)單化。錯(cuò)誤產(chǎn)生警報(bào)。

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

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

  1. redir()

  2. header()

  3. location()

  4. redirect()

  2

  14. What function can you use to open a file for reading and writing?

  1. fget();

  2. file_open();

  3. fopen();

  4. open_file();

  3

  15. What’s the difference between mysql_fetch_row() and mysql_fetch_array()?

  mysql_fetch_row():返回根據(jù)所取得的行生成的數(shù)組,如果沒(méi)有更多行則返回 FALSE。

  mysql_fetch_array(): 是mysq_fetch_row()的擴(kuò)展版本。除了將數(shù)據(jù)以數(shù)字索引方式儲(chǔ)存在數(shù)組中之外,還可以將數(shù)據(jù)作為關(guān)聯(lián)索引儲(chǔ)存,用字段名作為鍵名。

  16. What does the following code do? Explain what’s going on there.

  $date=’08/26/2003′;

  print ereg_replace(‘([0-9]+)/([0-9]+)/([0-9]+)’,’2/1/3′,$date);

  本函數(shù)以 正則 的規(guī)則來(lái)解析比對(duì)字符串 ,欲取而代之的字符串為’2/1/3′。

  返回值為字符串類(lèi)型,為取代后的字符串結(jié)果。

  17. Given a line of text $string, how would you write a regular expression to strip all the HTML tags from it?

  strip_tags

  18. What’s the difference between the way PHP and Perl distinguish between arrays and hashes?

  19. How can you get round the stateless nature of HTTP using PHP?

  20. What does the GD library do?

  21. Name a few ways to output (print) a block of HTML code in PHP?

  22. Is PHP better than Perl? – Discuss.

  如果成功則返回 TRUE,失敗則返回 FALSE。

【PHP面試題附答案】相關(guān)文章:

騰訊php程序員面試題目及答案08-03

關(guān)于PHP面試題的分享11-20

PHP筆試題及答案02-11

Linux系統(tǒng)工程師面試題(附答案)03-02

絕對(duì)出乎意料!Intel公司的最新面試題(附答案)11-06

PHP筆試題含答案02-11

CAD試卷「附答案」04-29

photoshop試題附答案12-19

蘋(píng)果面試題及答案11-13

面試題目及答案02-15