php开发面试题---php面试题英语(How do you debug a PHP application)

一、总结

一句话总结:

xdebug or use die() do it;

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

|||-begin

1. $users[] = ‘john’;
2. array_add($users,’john’);
3. array_push($users,’john’);
4. $users ||= ‘john’;

|||-end

2. array_add($users,’john’);
4. $users ||= ‘john’;

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

sort():   本函数对数组的值进行排序。当本函数结束时数组单元将被从最低到最高重新安排,array 中的单元赋予新的键名。这将删除原有的键名而不仅是重新排序。
asort(): 这个函数将数组的值重新排序,由小至大排列。数组的索引亦跟着值的 顺序而变动。当您在程序中需要重新整理数组值的 顺序时,就可以使用这个函数。
ksort(): 对数组按照键名排序,保留键名到数据的关联。本函数主要用于关联数组。
rsort(): 本函数对数组进行逆向排序(最高到最低)。与sort()执行相反的操作。

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

|||-begin

$num = 10;
function multiply(){
$num = $num * 10;
}
multiply();
echo $num;

|||-end

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、What does === do? What’s an example of something that will give true for ‘==’, but not ‘===’?

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

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

class myclass{}

9、How would you create an object, which is an instance of “myclass”?

$myoject = new myclass();

10、How do you access and set properties of a class from within the class?

getVar() or setVar()   ;

11、What is the difference between include & include_once? include & require?

require:PHP 程式在执行前,就会先读入 require 所指定引入的档案,使它变成 PHP 程式网页的一部份。常用的函式,亦可以这个方法将它引入网页中。错误产生致命错误。
include:这个函式一般是放在流程控制的处理区段中。PHP 程式网页在读到 include 的档案时,才将它读进来。这种方式,可以把程式执行时的流程简单化。错误产生警报。
include_once:此行为和include()语句类似,唯一区别是如果该文件中的代码已经被包含了,则不会再次包含。如同此语句名字暗示的那样,只会包含一次。

二、带答案的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():   本函数对数组的值进行排序。当本函数结束时数组单元将被从最低到最高重新安排,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 程式网页的一部份。常用的函式,亦可以这个方法将它引入网页中。错误产生致命错误。
include:这个函式一般是放在流程控制的处理区段中。PHP 程式网页在读到 include 的档案时,才将它读进来。这种方式,可以把程式执行时的流程简单化。错误产生警报。
include_once:此行为和include()语句类似,唯一区别是如果该文件中的代码已经被包含了,则不会再次包含。如同此语句名字暗示的那样,只会包含一次。
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():返回根据所取得的行生成的数组,如果没有更多行则返回 FALSE。
mysql_fetch_array(): 是mysq_fetch_row()的扩展版本。除了将数据以数字索引方式储存在数组中之外,还可以将数据作为关联索引储存,用字段名作为键名。
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);
本函数以 正则 的规则来解析比对字符串 ,欲取而代之的字符串为’2/1/3′。
返回值为字符串类型,为取代后的字符串结果。
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开发面试题---php面试题英语(How do you debug a PHP application)的更多相关文章

  1. php开发面试题---面试常用英语(你能介绍你自己吗?)

    php开发面试题---面试常用英语(你能介绍你自己吗?) 一.总结 一句话总结: Could you please describe yourself? 1.为什么觉得自己适合这份工作? Why do ...

  2. 100个iOS开发面试题汇总-王刚韧的技术博客

    100个iOS开发面试题汇总 关于iOS开发面试,不管对于招聘和应聘来说,面试都是很重要的一个环节,特别对于开发者来说,面试中的技术问题环节不仅是企业对应聘者技能和积累的考察,也是一个开发者自我检验的 ...

  3. 前端开发面试题收集 JS

    前端开发面试题收集-JS篇 收集经典的前端开发面试题 setTimeout的时间定义为0有什么用? javascript引擎是单线程处理任务的,它把任务放在队列中,不会同步执行,必须在完成一个任务后才 ...

  4. 前端开发面试题总结之——JAVASCRIPT(一)

    ___________________________________________________________________________________ 相关知识点 数据类型.运算.对象 ...

  5. 前端开发面试题总结之——HTML

    ______________________________________________________________________________________________ 相关知识点 ...

  6. 前端开发面试题总结之——CSS3

    ____________________________________________________________________________________________ 相关知识点 布 ...

  7. J2EE进阶(十四)超详细的Java后台开发面试题之Spring IOC与AOP

    J2EE进阶(十四)超详细的Java后台开发面试题之Spring IOC与AOP 前言   搜狐畅游笔试题中有一道问答题涉及到回答谈谈对Spring IOC与AOP的理解.特将相关内容进行整理.    ...

  8. 100个iOS开发面试题汇总

    100个iOS开发面试题汇总 关于iOS开发面试,不管对于招聘和应聘来说,面试都是很重要的一个环节,特别对于开发者来说,面试中的技术问题环节不仅是企业对应聘者技能和积累的考察,也是一个开发者自我检验的 ...

  9. 前端开发面试题总结之——JAVASCRIPT(三)

    ___________________________________________________________________________________ 相关知识点 数据类型.运算.对象 ...

随机推荐

  1. 读书笔记---《Docker 技术入门与实践》---其一

    一.镜像1.1.搜索 搜索所有nginx镜像 $ docker search nginx NAME DESCRIPTION STARS OFFICIAL AUTOMATED nginx Officia ...

  2. 了解linux web的监听工具

    zabbix cacti Nagios 本想安装的,但是安装需要一个 空的服务器,因为服务器已经有安装 LAMP,故没有去了解 尝试了 cacti ,因为本地环境版本问题,只能使用0.8.8a版本,并 ...

  3. PagedLOD模型对象选择关键技术点

    DatabaseCacheReadCallback这个类继承ReadCallback,在相交的测试中,场景可能有PagedLOD,而计算相交过程中,PagedLOD不是精度最高的节点,这样计算的就不准 ...

  4. 【JZOJ6403】a

    description analysis 考虑\((0,0,0)\)走到某个点\((i,j,k)\)的贡献,相当于插板问题 \(i+j\)个空插\(k\)个板可以有空,\(i\)个空插\(j\)个板可 ...

  5. 记一次为解决Python读取PDF文件的Shell操作

    目录 一.背景 二.问题 三.解决 四.一顿分析及 Shell 操作 五.后续 一.背景 本想将 PDF 文件转换为 Word 文档,然后网上搜索了一下发现有挺多转换的软件.有的是免费的.收费,咱也不 ...

  6. Python 空值和非空值

    1)任何值为0的值都是false,任何非0的值都是true if -0.0: print 'yes' #不打印yes if -0.1: print 'yes' #打印yes 2)任何为空的值都是fla ...

  7. CM自动化安装CDH5.14.0详解

    CDH5.14.0版本说明 CDH最早版本只包含hadoop.hive.hbase等基础组件,CDH5.14.0版本目前已经封装了spark.impala.kudu(CDH 5.13.x开始)等众多组 ...

  8. Vue.js - 路由 vue-router 的使用详解2(参数传递)

    一.使用冒号(:)的形式传递参数 1,路由列表的参数设置 (1)路由列表的 path 是可以带参数的,我们在路由配置文件(router/index.js)里以冒号的形式设置参数. (2)下面样例代码中 ...

  9. LeetCode 620. Not Boring Movies (有趣的电影)

    题目标签: 题目给了我们一个 cinema 表格, 让我们找出 不无聊的电影,并且id 是奇数的,降序排列. 比较直接简单的,具体看code. Java Solution: Runtime:  149 ...

  10. Python匹马天下行之python基本语法

    输出 输出皆是在控制台打印出要打印的内容,在python中用print("内容") 在括号中加入要输出的内容就可以打印出来了. 例: print("Hello Pytho ...