据说是雅虎的一份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入门
Oct 09 PHP
php巧获服务器端信息
Dec 06 PHP
如何用PHP实现插入排序?
Apr 10 PHP
PHP限制页面只能在微信自带浏览器访问的代码
Jan 15 PHP
一个php短网址的生成代码(仿微博短网址)
May 07 PHP
php使用fsockopen函数发送post,get请求获取网页内容的方法
Nov 15 PHP
PHP简单的MVC框架实现方法
Dec 01 PHP
php实现图片缩略图的方法
Mar 29 PHP
php代码检查代理ip的有效性
Aug 19 PHP
详解PHP中的序列化、反序列化操作
Mar 21 PHP
PHP addslashes()函数讲解
Feb 03 PHP
Laravel jwt 多表(多用户端)验证隔离的实现
Dec 18 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实现分页的一个示例
2006/10/09 PHP
php define的第二个参数使用方法
2013/11/04 PHP
php+highchats生成动态统计图
2014/05/21 PHP
PHP中使用file_get_contents post数据代码例子
2015/02/13 PHP
PHP获取网页所有连接的方法(附demo源码下载)
2016/03/30 PHP
给moz-firefox下添加IE方法和属性
2007/04/10 Javascript
javascript 密码强弱度检测万能插件
2009/02/25 Javascript
jquery下将选择的checkbox的id组成字符串的方法
2010/11/28 Javascript
jquery连缀语法如何实现
2012/11/29 Javascript
在JavaScript里嵌入大量字符串常量的实现方法
2013/07/07 Javascript
使用jQuery实现验证上传图片的格式与大小
2014/12/03 Javascript
JS使用eval()动态创建变量的方法
2016/06/03 Javascript
js实现动态显示时间效果
2017/03/06 Javascript
nodejs接入阿里大鱼短信验证码的方法
2017/07/10 NodeJs
AngularJS中的作用域实例分析
2018/05/16 Javascript
浅谈Vue.js 中的 v-on 事件指令的使用
2018/11/25 Javascript
js实现录音上传功能
2019/11/22 Javascript
JavaScript浅层克隆与深度克隆示例详解
2020/09/01 Javascript
[01:34]2014DOTA2展望TI 剑指西雅图VG战队专访
2014/06/30 DOTA
Python模块包中__init__.py文件功能分析
2016/06/14 Python
基于pip install django失败时的解决方法
2018/06/12 Python
TensorFlow打印tensor值的实现方法
2018/07/27 Python
Django关于admin的使用技巧和知识点
2020/02/10 Python
Python爬虫实现自动登录、签到功能的代码
2020/08/20 Python
CSS3的新特性介绍
2008/10/31 HTML / CSS
用CSS3实现无限循环的无缝滚动的示例代码
2017/11/01 HTML / CSS
能否解释一下XSS cookie盗窃是什么意思
2012/06/02 面试题
优质的学校老师推荐信
2013/10/28 职场文书
总结表彰大会主持词
2014/03/26 职场文书
电教室标语
2014/06/20 职场文书
出资证明书范本(标准版)
2014/09/24 职场文书
四风问题对照检查材料整改措施
2014/09/27 职场文书
2015新年寄语大全
2014/12/08 职场文书
学校光盘行动倡议书
2015/04/28 职场文书
2020年基层司法所建设情况调研报告
2019/11/30 职场文书
nginx服务器的下载安装与使用详解
2021/08/02 Servers