据说是雅虎的一份PHP面试题附答案

所属分类: 网络编程 / PHP编程 阅读数: 450
收藏 0 赞 0 分享
从网上搜集到的,据说是雅虎的面试题。
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 setTime 设置当前时间的代码

在用JAVA中有个 Calendar 可设置当前时间,在PHP中找了半天,终于给我找到了这个函数,嘎嘎
收藏 0 赞 0 分享

PHP 图片水印类代码

这个类功能很强大,细节很棒!希望大家喜欢,并积极指点
收藏 0 赞 0 分享

PHP实现手机归属地查询API接口实现代码

主要使用curl实现,需要开启php对curl的支持
收藏 0 赞 0 分享

php 解决旧系统 查出所有数据分页的类

不同之处在于 没有实现分页的系统, 默认全部查出来 现在就要不能动后台的基础上进行操作 可以采用 相应的 如下 代码
收藏 0 赞 0 分享

PHP的简易冒泡法代码分享

基础的东西,感觉代码还不够简洁,希望高手指导修改,脚本之家特为大家多准备了几个,方便测试学习
收藏 0 赞 0 分享

PHP 利用AJAX获取网页并输出的实现代码(Zjmainstay)

PHP 利用AJAX获取网页并输出的实现代码,需要的朋友可以参考下
收藏 0 赞 0 分享

php数组一对一替换实现代码

以下方法能实现匹配关键词并分别对关键词做特殊处理的功能,需要的朋友可以参考下
收藏 0 赞 0 分享

关于UEditor编辑器远程图片上传失败的解决办法

因为单纯喜欢 UEditor 的界面,于是把项目中原先的编辑器进行的替换,但在后续操作中发现一些问题,就是远程图片上传
收藏 0 赞 0 分享

Windows下部署Apache+PHP+MySQL运行环境实战

本来嘛,部署PHP没什么复杂,找各种版本着实头疼了一下。
收藏 0 赞 0 分享

比较discuz和ecshop的截取字符串函数php版

网上看到一篇文章 discuz和ecshop截取字符串的两个函数,比较了一下两个版本的函数,都各有局限,只能在特定的前提下使用,但是学习一下有利于拓宽思路,了解PHP的扩展功能
收藏 0 赞 0 分享
查看更多