据说是雅虎的一份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简介
Oct 09 PHP
40个迹象表明你还是PHP菜鸟
Sep 29 PHP
php str_pad() 将字符串填充成指定长度的字符串
Feb 23 PHP
php中显示数组与对象的实现代码
Apr 18 PHP
php数组函数序列之asort() - 对数组的元素值进行升序排序,保持索引关系
Nov 02 PHP
PHP中如何定义和使用常量
Feb 28 PHP
为百度UE编辑器上传图片添加水印功能
Apr 16 PHP
phpmailer绑定邮箱的实现方法
Dec 01 PHP
PHP面向对象程序设计OOP继承用法入门示例
Dec 27 PHP
PHP从零开始打造自己的MVC框架之类的自动加载实现方法详解
Jun 03 PHP
YII2框架中使用RBAC对模块,控制器,方法的权限控制及规则的使用示例
Mar 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笔记之:初探PHPcms模块开发介绍
2013/04/26 PHP
支持生僻字且自动识别utf-8编码的php汉字转拼音类
2014/06/27 PHP
今天你说520了吗?不仅有php表白书还有java表白神器
2016/05/20 PHP
PHP操作MySQL中BLOB字段的方法示例【存储文本与图片】
2017/09/15 PHP
PHP实现求解最长公共子串问题的方法
2017/11/17 PHP
详解laravel passport OAuth2.0的4种模式
2019/11/04 PHP
2010年最佳jQuery插件整理
2010/12/06 Javascript
JavaScript中几个重要的属性(this、constructor、prototype)介绍
2013/05/19 Javascript
js获取控件位置以及不同浏览器中的差别介绍
2013/08/08 Javascript
jquery进行数组遍历如何跳出当前的each循环
2014/06/05 Javascript
Node.js插件的正确编写方式
2014/08/03 Javascript
使用JavaScript实现ajax的实例代码
2016/05/11 Javascript
ES6所改良的javascript“缺陷”问题
2016/08/23 Javascript
JS+canvas实现的五子棋游戏【人机大战版】
2017/07/19 Javascript
arcgis for js栅格图层叠加(Raster Layer)问题
2017/11/22 Javascript
NodeJS简单实现WebSocket功能示例
2018/02/10 NodeJs
详解vue指令与$nextTick 操作DOM的不同之处
2018/08/02 Javascript
Vue-router的使用和出现空白页,路由对象属性详解
2018/09/03 Javascript
微信小程序自定义组件实现环形进度条
2020/11/17 Javascript
JavaScript实现省市联动效果
2019/11/22 Javascript
Python深入学习之内存管理
2014/08/31 Python
Python手机号码归属地查询代码
2016/05/04 Python
Python 基础之字符串string详解及实例
2017/04/01 Python
Python使用defaultdict读取文件各列的方法
2017/05/11 Python
Python读取图片为16进制表示简单代码
2018/01/19 Python
Python用csv写入文件_消除空余行的方法
2018/07/06 Python
Python开发的十个小贴士和技巧及长常犯错误
2018/09/27 Python
python-tornado的接口用swagger进行包装的实例
2019/08/29 Python
详解Python实现进度条的4种方式
2020/01/15 Python
CSS3中Transition动画属性用法详解
2016/07/04 HTML / CSS
精选鞋类、服装和配饰的全球领先目的地:Bodega
2021/02/27 全球购物
运动会邀请函范文
2014/02/06 职场文书
《会走路的树》教后反思
2014/04/19 职场文书
2015年妇幼卫生工作总结
2015/05/23 职场文书
当你找不到方向的时候,不妨读读刘备的一生
2019/08/05 职场文书
Mysql中一千万条数据怎么快速查询
2021/12/06 MySQL