+ -
当前位置:首页 → 问答吧 → PHP Interview questions from YAHOO

PHP Interview questions from YAHOO

时间:2007-07-21

来源:互联网

From: http://bbs.nucer.org/viewthread.php?tid=342&extra=page%3D1

呵呵,翻译了篇东西,N长时间没用英语了,出了丑大家可一定要指出来啊。翻译自:Nick Halstead's Blog

A friend recently got some pre-interview questions from YAHOO for a PHP job. Following up my previous post about programmer questions I thought I would post them to give people examples of what a large corporation like YAHOO asks.

最近一位朋友得到了Yahoo的一些PHP面试题目,依照我之前发表关于程序员的相关文章的原则,我想我应该在这里发布出来,以给读者朋友们提供一些例子,让大家看看像YAHOO这样的大公司关心哪些问题。

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

1、下面哪个选项没有将 john 添加到users 数组中?

         1. $users[] = ‘john’;

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

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

         4. $users ||= ‘john’;


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

2、sort(), asort()(注:原作者为assort,应该是笔误)和ksort() 三者之间有什么差别?你分别在什么情况下会使用上面三个函数?

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

3、下面这段代码将在浏览器上打印出什么内容?为什么?

      $num = 10;

      function multiply(){

            $num = $num * 10;

      }

      multiply();

      echo $num;


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

4、引用变量与普通变量之间有何区别?如何通过引用传值?在什么情况下会这样做?

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

5、哪些函数可以被用来向当前的代码中添加库代码?

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

6、foo()和@foo()之间有什么区别?

7. How do you debug a PHP application?

7、你如何调试你的PHP程序?

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

8、===是什么运算符?请举一个例子,说明在什么情况下使用==会得到true,而使用===却是false。

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

9、如何声明一个名为”myclass”的没有方法和属性的类?

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

10、如何实例化一个名为”myclass”的对象?

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

11、你如何访问和设置一个类的属性?

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

12、include和include_once,include和require之间分别有什么区别?

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

13、下面哪个函数可以重定向浏览器到一个新的页面?

         1. redir()

         2. header()

         3. location()

         4. redirect()


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

14、下面哪个函数可以打开一个文件,以对文件进行读和写操作?

         1. fget();

         2. file_open();

         3. fopen();

         4. open_file();


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

15、mysql_fetch_row() 和mysql_fetch_array之间有什么区别?

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

16、下面这段代码执行了什么操作?解释一下每一步都发生了什么。

      $date=’08/26/2003’;

      print ereg_replace(“([0-9]+)/([0-9]+)/([0-9]+)”,\\2/\\1/\\3,$date);


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

17、给你一个字符串变量$string,请编写一个正则表达式,去除其中的html标记。

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

18、PHP和Perl中区别数组和hashes的方法有什么不同?

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

19、在PHP中如何避开PHP无连接的特性?

20. What does the GD library do?

20、GD库是做什么用的?

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

21、指出一些在PHP输入一段HTML代码的办法。

22. Is PHP better than Perl? �C Discuss.

22、PHP比Peral好吗?(讨论)

I have no idea if there are different levels of PHP tests within YAHOO but this seems to be much easier level than something like the Zend Certification questions which require at times encyclopedic knowledge of the language (thank god I passed!).

我不知道YAHOO是不是有不同水平的PHP测试题,但这份题看起来比Zend认证考试要容易一些,那个要求你对PHP这门语言了解的像百科全书一样(感谢上帝,我还是通过了)。

作者: kedy   发布时间: 2007-07-20

:Q 我要象牙

作者: pack08   发布时间: 2007-07-20

看了一下不太明白:)

作者: maikongjian11   发布时间: 2007-07-27

有客观有主观。。
ZEND认证比这个难多少?

作者: thankwsx   发布时间: 2007-07-27

简单像吃菜一样.

作者: jiania   发布时间: 2007-07-27