据说是雅虎的一份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 相关文章推荐
PHP的FTP学习(一)
Oct 09 PHP
PHP写入WRITE编码为UTF8的文件的实现代码
Jul 07 PHP
php修改NetBeans默认字体的大小
Jul 02 PHP
ThinkPHP利用PHPMailer实现邮件发送实现代码
Sep 26 PHP
Windows下的PHP安装文件线程安全和非线程安全的区别
Apr 23 PHP
php上传文件常见问题总结
Feb 03 PHP
功能强大的PHP POST提交数据类
Jul 15 PHP
iOS10推送通知开发教程
Sep 19 PHP
php实现文件预览功能
May 23 PHP
PHP环形链表实现方法示例
Sep 15 PHP
实例讲解PHP表单处理
Feb 15 PHP
PHP实现给定一列字符,生成指定长度的所有可能组合示例
Jun 22 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
php中数据的批量导入(csv文件)
2006/10/09 PHP
php初学者写及时补给skype用户充话费的小程序
2008/11/02 PHP
PHP 7.0.2 正式版发布
2016/01/08 PHP
Yii2中OAuth扩展及QQ互联登录实现方法
2016/05/16 PHP
ajax+php实现无刷新验证手机号的实例
2017/12/22 PHP
javascript 用记忆函数快速计算递归函数
2010/03/15 Javascript
一个js导致的jquery失效问题的解决方法
2013/11/27 Javascript
showModalDialog在谷歌浏览器下会返回Null的解决方法
2013/11/27 Javascript
探讨js字符串数组拼接的性能问题
2014/10/11 Javascript
JavaScript简单判断复选框是否选中及取出值的方法
2015/08/13 Javascript
基于jQuery下拉选择框插件支持单选多选功能代码
2016/06/07 Javascript
通过jsonp获取json数据实现AJAX跨域请求
2017/01/22 Javascript
解决URL地址中的中文乱码问题的办法
2017/02/10 Javascript
浅谈Vue 初始化性能优化
2017/08/31 Javascript
React Native之prop-types进行属性确认详解
2017/12/19 Javascript
jquery动态添加以及遍历option并获取特定样式名称的option方法
2018/01/29 jQuery
vue-cli webpack2项目打包优化分享
2018/02/07 Javascript
vue父组件给子组件的组件传值provide inject的方法
2019/10/23 Javascript
简单了解JS打开url的方法
2020/02/21 Javascript
JavaScript 装逼指南(js另类写法)
2020/05/10 Javascript
python实现绘制树枝简单示例
2014/07/24 Python
Python轻量级ORM框架Peewee访问sqlite数据库的方法详解
2017/07/20 Python
Python实现的插入排序算法原理与用法实例分析
2017/11/22 Python
对python读写文件去重、RE、set的使用详解
2018/12/11 Python
Python实战之制作天气查询软件
2019/05/14 Python
与Django结合利用模型对上传图片预测的实例详解
2019/08/07 Python
python实现取余操作的简单实例
2020/08/16 Python
在HTML5中使用MathML数学公式的简单讲解
2016/02/19 HTML / CSS
Clarisonic美国官网:科莱丽声波洁面仪
2017/10/12 全球购物
会计电算化专业个人的自我评价
2013/11/24 职场文书
初二生物教学反思
2014/02/03 职场文书
2014年党务公开实施方案
2014/02/27 职场文书
员工薪酬激励方案
2014/06/13 职场文书
机电专业毕业生求职信
2014/07/01 职场文书
MySQL大小写敏感的注意事项
2021/05/24 MySQL
python 安全地删除列表元素的方法
2022/03/16 Python