据说是雅虎的一份PHP面试题附答案


Posted in PHP onJanuary 07, 2009

从网上搜集到的,据说是雅虎的面试题。
1. Which of the following will not add john to the users array?
1. $users[] = 'john';
2. array_add($users,'john'); //wrong
3. array_push($users,'john');
4. $users ||= 'john'; //wrong
2. What's the difference between sort(), asort() and ksort? Under what circumstances would you use each of these?
my an:sort()-排序 asort()-保持key值排序 ksort()-以key顺序排序 rsort()-逆排序 arsort()-保持key值逆排序 krsort()-以key逆顺序排序
3. What would the following code print to the browser? Why?
$num = 10;
function multiply()
{
$num = $num * 10;
}
multiply();
echo $num;
my an:10 because var scope4. What is the difference between a reference and a regular variable? How do you pass by reference & why would you want to?
5. What functions can you use to add library code to the currently running script?
6. What is the difference between foo() & @foo()?
7. How do you debug a PHP application?
8. What does === do? What's an example of something that will give true for ‘==', but not ‘==='?
9. How would you declare a class named “myclass” with no methods or properties?
10. How would you create an object, which is an instance of “myclass”?
11. How do you access and set properties of a class from within the class?
12. What is the difference between include & include_once? include & require?
13. What function would you use to redirect the browser to a new page?
1. redir() 2. header() 3. location() 4. redirect()
my an :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();my an :315. What's the difference between mysql_fetch_row() and mysql_fetch_array()?
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);17. Given a line of text $string, how would you write a regular expression to strip all the HTML tags from it?
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.

PHP 相关文章推荐
VFP与其他应用程序的集成
Oct 09 PHP
phpBB BBcode处理的漏洞
Oct 09 PHP
使用PHP 5.0创建图形的巧妙方法
Oct 12 PHP
PHP自带函数给数字或字符串自动补齐位数
Jul 29 PHP
PHP实现在线阅读PDF文件的方法
Jun 23 PHP
PHP 接入支付宝即时到账功能
Sep 18 PHP
PHP Header失效的原因分析及解决方法
Nov 16 PHP
深入理解Yii2.0乐观锁与悲观锁的原理与使用
Jul 26 PHP
yii gridview实现时间段筛选功能
Aug 15 PHP
PHP有序表查找之二分查找(折半查找)算法示例
Feb 09 PHP
php使用curl_init()和curl_multi_init()多线程的速度比较详解
Aug 15 PHP
tp5框架使用composer实现日志记录功能示例
Jan 10 PHP
PHP 地址栏信息的获取代码
Jan 07 #PHP
php 禁止页面缓存输出
Jan 07 #PHP
php 时间计算问题小结
Jan 04 #PHP
PHP 常用函数库和一些实用小技巧
Jan 01 #PHP
php zlib压缩和解压缩swf文件的代码
Dec 30 #PHP
PHP HTML代码串截取代码
Dec 29 #PHP
PHP MSSQL 存储过程的方法
Dec 24 #PHP
You might like
晋城吧对DiscuzX进行的前端优化要点
2010/09/05 PHP
PHP命名空间(Namespace)的使用详解
2013/05/04 PHP
PHP Warning: Module 'modulename' already loaded in问题解决办法
2015/03/16 PHP
PHP中set error handler函数用法小结
2015/11/11 PHP
PHP实现动态获取函数参数的方法示例
2018/04/02 PHP
PHP+redis实现微博的拉模型案例详解
2019/07/10 PHP
JS启动应用程序的一个简单例子
2008/05/11 Javascript
jquery学习笔记二 实现可编辑的表格
2010/04/09 Javascript
jQuery 1.8 Release版本发布了
2012/08/14 Javascript
javascript加号"+"的二义性说明
2013/03/04 Javascript
javascript实现tabs选项卡切换效果(扩展版)
2013/03/19 Javascript
js jquery分别实现动态的文件上传操作按钮的添加和删除
2014/01/13 Javascript
js的2种继承方式详解
2014/03/04 Javascript
AngularJS equal比较对象实例详解
2016/09/14 Javascript
解析利用javascript如何判断一个数为素数
2016/12/08 Javascript
微信小程序开发之圆形菜单 仿建行圆形菜单实例
2016/12/12 Javascript
ES6概念 ymbol.for()方法
2016/12/25 Javascript
微信小程序 this和that详解及简单实例
2017/02/13 Javascript
angularJS之$http:与服务器交互示例
2017/03/17 Javascript
socket.io学习教程之基础介绍(一)
2017/04/29 Javascript
JS数组操作中的经典算法实例讲解
2017/07/26 Javascript
结合Vue控制字符和字节的显示个数的示例
2018/05/17 Javascript
vue生成文件本地打开查看效果的实例
2018/09/06 Javascript
微信小程序自定义导航栏(模板化)
2019/11/15 Javascript
[01:22:28]DOTA2-DPC中国联赛 正赛 SAG vs RNG BO3 第一场 1月18日
2021/03/11 DOTA
python paramiko实现ssh远程访问的方法
2013/12/03 Python
举例讲解Python面向对象编程中类的继承
2016/06/17 Python
python特性语法之遍历、公共方法、引用
2018/08/08 Python
python requests爬取高德地图数据的实例
2018/11/10 Python
Python 3.8 新功能全解
2019/07/25 Python
Python按照list dict key进行排序过程解析
2020/04/04 Python
Django 解决上传文件时,request.FILES为空的问题
2020/05/20 Python
奥巴马就职演讲稿
2014/05/15 职场文书
2015年学校体育工作总结
2015/04/22 职场文书
《有余数的除法》教学反思
2016/02/22 职场文书
在ubuntu下安装go开发环境的全过程
2022/08/05 Golang