据说是雅虎的一份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学习 计数器实例代码
Jun 15 PHP
PHP 字符串编码截取函数(兼容utf-8和gb2312)
May 02 PHP
PHP 基本语法格式
Dec 15 PHP
基于session_unset与session_destroy的区别详解
Jun 03 PHP
php操作xml入门之xml标签的属性分析
Jan 23 PHP
php实现随机生成易于记忆的密码
Jun 19 PHP
php计算title标题相似比的方法
Jul 29 PHP
php+ajax注册实时验证功能
Jul 20 PHP
PHP运行模式汇总
Nov 06 PHP
详解php中curl返回false的解决办法
Mar 18 PHP
PHP使用观察者模式处理异常信息的方法详解
Sep 24 PHP
php设计模式之适配器模式实例分析【星际争霸游戏案例】
Apr 07 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实现上传图片生成缩略图示例
2014/04/13 PHP
利用PHPStorm如何开发Laravel应用详解
2017/08/30 PHP
Add Formatted Text to a Word Document
2007/06/15 Javascript
一些Javascript的IE和Firefox(火狐)兼容性的问题总结及常用例子
2009/05/21 Javascript
javascript 三种编解码方式
2010/02/01 Javascript
js对象的比较
2011/02/26 Javascript
JS实现在页面随时自定义背景颜色的方法
2015/02/27 Javascript
详解js中class的多种函数封装方法
2016/01/03 Javascript
JavaScript事件详细讲解
2016/06/27 Javascript
jQuery插件jquery.kxbdmarquee.js实现无缝滚动效果
2017/02/15 Javascript
扩展bootstrap的modal模态框-动态添加modal框-弹出多个modal框
2017/02/21 Javascript
jQuery zTree树插件动态加载实例代码
2017/05/11 jQuery
js 索引下标之li集合绑定点击事件
2018/01/12 Javascript
轻量级JS Cookie插件js-cookie的使用方法
2018/03/22 Javascript
详解Vue 全局引入bass.scss 处理方案
2018/03/26 Javascript
详解VS Code使用之Vue工程配置format代码格式化
2019/03/20 Javascript
JavaScript字符串处理常见操作方法小结
2019/11/15 Javascript
在Python程序中操作文件之flush()方法的使用教程
2015/05/24 Python
Python中max函数用于二维列表的实例
2018/04/03 Python
python中break、continue 、exit() 、pass终止循环的区别详解
2019/07/08 Python
利用python在大量数据文件下删除某一行的例子
2019/08/21 Python
Python常用模块logging——日志输出功能(示例代码)
2019/11/20 Python
使用python实现多维数据降维操作
2020/02/24 Python
PyTorch-GPU加速实例
2020/06/23 Python
顶丰TOPPIK台湾官网:增发纤维假发,告别秃发困扰
2018/06/13 全球购物
东方通信股份有限公司VC面试题
2014/08/27 面试题
大学生个人简历中的自我评价
2013/12/27 职场文书
快递业务员岗位职责
2014/01/06 职场文书
优秀员工演讲稿
2014/05/19 职场文书
户籍证明模板
2014/09/28 职场文书
自主招生学校推荐信范文
2015/03/26 职场文书
2015七夕情人节宣传语
2015/07/14 职场文书
pytorch finetuning 自己的图片进行训练操作
2021/06/05 Python
MySQL子查询中order by不生效问题的解决方法
2021/08/02 MySQL
MySQL控制流函数(-if ,elseif,else,case...when)
2022/07/07 MySQL