全球旧事资料 分类
一份不错的php面试题附答案有准备换工作的同学可以参考一下一、基础题1写出如下程序的输出结果
phpstr1
ullstr2falseechostr1str2相等不相等str3str40echostr3str4相等不相等str50str60echostr5str6相等不相等
相等
相等不相等
2写出如下程序的输出结果
phpa1
ulla2falsea30a4a50a6
ulla7array
fa8arrayarrayechoemptya1truefalsetrueechoemptya2truefalsetrueechoemptya3truefalsetrueechoemptya4truefalsetrueechoemptya5truefalsetrueechoemptya6truefalsefalseechoemptya7truefalsetrueechoemptya8truefalsefalse
3写出如下程序的输出结果
phptestaaaaaaabctestu
settestechoabc变量引用test与abc引用同一位置实际为abc引用test变量所以echoaaaaaa
4写出如下程序的输出结果________________________________X
phpcou
t5fu
ctio
get_cou
tstaticcou
t0
fretur
cou
techocou
t5cou
techoget_cou
t0staticcou
t1echoget_cou
t15写出如下程序的输出结果
phpGLOBALSvar15var21fu
ctio
get_valueglobalvar2var10retur
var2get_valueechovar15echovar226写出如下程序的输出结果
phpfu
ctio
get_arrarru
setarr0arr1array12arr2array12
fget_arrarr1get_arrarr2echocou
tarr11echocou
tarr227使用五种以上方式获取一个文件的扩展名要求:diruploadimagejpg,找出jpg或者jpg,必须使用PHP自带的处理函数进行处理,方法不能明显重复,可以封装成函数,比如get_ext1file_
ameget_ext2file_
ame二、算法题1使用PHP描述冒泡排序和快速排序算法,对象可以是一个数组2使用PHP描述顺序查找和二分查找(也叫做折半查找)算法,顺序查找必须考虑效率,对象可以是一个有序数组3写一个二维数组排序算法函数,能够具有通用性,可以调用php内置函数
【答案】(以下答案不一定是最好的,只是一个简单的参考)一、基础题1相等相等不相等2truetruetruetruetruefalsetruefalse3aaaaaa论二参考httpmyoschi
a
etba
boblog303306里面的结
45015526127使用五种以上方式获取一个文件的扩展名
ffu
ctio
get_ext1file_
ameretur
strrchrfile_
amefu
ctio
get_ext2file_
ameretur
substrfile_
amestrrposfile_
amefu
ctio
get_ext3file_
ameretur
array_popexplodefile_
amefu
ctio
get_ext4file_
ameretur
pathi
fofile_
amePATHINFO_EXTENSIONr
好听全球资料 返回顶部