据说是雅虎的一份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 相关文章推荐
一个阿拉伯数字转中文数字的函数
Oct 09 PHP
Win9x/ME下Apache+PHP安装配置
Oct 09 PHP
PHP集成FCK的函数代码
Sep 27 PHP
php中对2个数组相加的函数
Jun 24 PHP
PHP面向对象概念
Nov 06 PHP
支持中文的php加密解密类代码
Nov 27 PHP
PHP 利用AJAX获取网页并输出的实现代码(Zjmainstay)
Aug 31 PHP
基于AppServ,XAMPP,WAMP配置php.ini去掉警告信息(NOTICE)的方法详解
May 07 PHP
Mac下php 5升级到php 7的步骤详解
Apr 26 PHP
三个思路解决laravel上传文件报错:413 Request Entity Too Large问题
Nov 13 PHP
PHP常用字符串函数小结(推荐)
Aug 05 PHP
PHP实现的用户注册表单验证功能简单示例
Feb 25 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
解析thinkphp中的M()与D()方法的区别
2013/06/22 PHP
PHP 线程安全与非线程安全版本的区别深入解析
2013/08/06 PHP
PHPUnit测试私有属性和方法功能示例
2018/06/12 PHP
thinkPHP5使用Rabc实现权限管理
2019/08/28 PHP
解决在laravel中leftjoin带条件查询没有返回右表为NULL的问题
2019/10/15 PHP
客户端静态页面玩分页
2006/06/26 Javascript
JavaScript 无符号右移赋值操作
2009/04/17 Javascript
jquery中prop()方法和attr()方法的区别浅析
2013/09/06 Javascript
第一次接触神奇的Bootstrap网格系统
2016/07/27 Javascript
js实现String.Fomat的实例代码
2016/09/02 Javascript
SpringMVC+bootstrap table实例详解
2017/06/02 Javascript
基于vue-cli vue-router搭建底部导航栏移动前端项目
2018/02/28 Javascript
webpack4.0 入门实践教程
2018/10/08 Javascript
搭建基于express框架运行环境的方法步骤
2018/11/15 Javascript
微信小程序实现获取小程序码和二维码java接口开发
2019/03/29 Javascript
python中as用法实例分析
2015/04/30 Python
Python3实现发送QQ邮件功能(附件)
2020/12/23 Python
Python设计模式之观察者模式原理与用法详解
2019/01/16 Python
Python实现程序判断季节的代码示例
2019/01/28 Python
Python脚本按照当前日期创建多级目录
2019/03/01 Python
python数据预处理之数据标准化的几种处理方式
2019/07/17 Python
python-web根据元素属性进行定位的方法
2019/12/13 Python
Python按照list dict key进行排序过程解析
2020/04/04 Python
Python字典取键、值对的方法步骤
2020/09/30 Python
VSCODE配置Markdown及Markdown基础语法详解
2021/01/19 Python
HTML5+CSS3绘制锯齿状的矩形
2016/03/01 HTML / CSS
岗位职责风险防控
2014/02/18 职场文书
个人三严三实对照检查材料思想汇报
2014/09/22 职场文书
质量主管工作职责
2014/09/26 职场文书
在教室放鞭炮的检讨书
2014/09/28 职场文书
2014年纠风工作总结
2014/12/08 职场文书
2019年入党思想汇报
2019/03/25 职场文书
SpringBoot系列之MongoDB Aggregations用法详解
2022/02/12 MongoDB
工厂无线对讲系统解决方案
2022/02/18 无线电
搞笑Gif:这么白这么长的腿像极了一楼的女朋友
2022/03/21 杂记
nginx rewrite功能使用场景分析
2022/05/30 Servers