据说是雅虎的一份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 相关文章推荐
PHP5 安装方法
Oct 09 PHP
PHP 图片文件上传实现代码
Dec 29 PHP
解析file_get_contents模仿浏览器头(user_agent)获取数据
Jun 27 PHP
根据中文裁减字符串函数的php代码
Dec 03 PHP
Yii学习总结之数据访问对象 (DAO)
Feb 22 PHP
PHP判断一个字符串是否是回文字符串的方法
Mar 23 PHP
PHP用反撇号执行外部命令
Apr 14 PHP
php一个解析字符串排列数组的方法
May 12 PHP
ThinkPHP实现递归无级分类――代码少
Jul 29 PHP
PHP在innodb引擎下快速代建全文搜索功能简明教程【基于xunsearch】
Oct 14 PHP
php设计模式之观察者模式实例详解【星际争霸游戏案例】
Mar 30 PHP
PHP 出现 http500 错误的解决方法
Mar 09 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
114啦源码(114la)不能生成地方房产和地方报刊问题4级页面0字节的解决方法
2012/01/12 PHP
thinkphp隐藏index.php/home并允许访问其他模块的实现方法
2016/10/13 PHP
thinkphp整合系列之极验滑动验证码geetest功能
2019/06/18 PHP
显示、隐藏密码
2006/07/01 Javascript
javascript编程起步(第二课)
2007/01/10 Javascript
js 分页全选或反选标识实现代码
2011/08/09 Javascript
FireFox下XML对象转化成字符串的解决方法
2011/12/09 Javascript
JavaScript中的方法调用详细介绍
2014/12/30 Javascript
JavaScript 模块化编程(笔记)
2015/04/08 Javascript
Javascript中常用类型的格式化方法小结
2016/12/26 Javascript
浅谈原生JS实现jQuery的animate()动画示例
2017/03/08 Javascript
微信小程序录音与播放录音功能
2017/12/25 Javascript
简述JS浏览器的三种弹窗
2018/07/15 Javascript
详解小程序毫秒级倒计时(适用于拼团秒杀功能)
2019/05/05 Javascript
深入理解 ES6中的 Reflect用法
2020/07/18 Javascript
微信小程序实现点赞业务
2021/02/10 Javascript
使用python实现拉钩网上的FizzBuzzWhizz问题示例
2014/05/05 Python
Python实现对比不同字体中的同一字符的显示效果
2015/04/23 Python
python字符串,数值计算
2016/10/05 Python
Python排序算法实例代码
2017/08/10 Python
使用python实现BLAST
2018/02/12 Python
python使用梯度下降算法实现一个多线性回归
2020/03/24 Python
Python分析最近大火的网剧《隐秘的角落》
2020/07/02 Python
jupyter使用自动补全和切换默认浏览器的方法
2020/11/18 Python
让IE9以下版本的浏览器兼容HTML5的方法
2014/03/12 HTML / CSS
纽约现代艺术博物馆商店:MoMA STORE(室内家具和杂货商品)
2016/08/02 全球购物
Vision Direct比利时:在线订购隐形眼镜
2019/08/27 全球购物
职工运动会邀请函
2014/01/19 职场文书
大学生求职计划书
2014/04/30 职场文书
乳制品整治工作方案
2014/05/29 职场文书
停电放假通知
2015/04/14 职场文书
详解MySQL中的主键与事务
2021/05/27 MySQL
springboot集成flyway自动创表的详细配置
2021/06/26 Java/Android
CSS实现两列布局的N种方法
2021/08/02 HTML / CSS
浅析python中特殊文件和特殊函数
2022/02/24 Python
SpringCloud Feign请求头删除修改的操作代码
2022/03/20 Java/Android