1写出如下程序的输出结果str1
ullstr2falseechostr1str2相等不相等
str3str40echostr3str4相等不相等
str50str60echostr5str6相等不相等
2写出如下程序的输出结果a1
ulla2falsea30a4a50a6
ulla7arraya8arrayarray
echoemptya1truefalseechoemptya2truefalseechoemptya3truefalseechoemptya4truefalseechoemptya5truefalseechoemptya6truefalseechoemptya7truefalseechoemptya8truefalse
f
3写出如下程序的输出结果testaaaaaaabctestu
settest
echoabc
4写出如下程序的输出结果cou
t5fu
ctio
get_cou
tstaticcou
t0retur
cou
t
echocou
tcou
techoget_cou
techoget_cou
t
5写出如下程序的输出结果GLOBALSvar15var21fu
ctio
get_valueglobalvar2var10retur
var2get_value
fechovar1echovar2
6写出如下程序的输出结果fu
ctio
get_arrarru
setarr0arr1array12arr2array12
get_arrarr1get_arrarr2
echocou
tarr1echocou
tarr2
7使用五种以上方式获取一个文件的扩展名
要求:diruploadimagejpg,找出jpg或者jpg,必须使用PHP自带的处理函数进行处理,方法不能明显重复,可以封装成函数,比如get_ext1file_
ameget_ext2file_
ame
二、算法题
1使用PHP描述冒泡排序和快速排序算法,对象可以是一个数组
2使用PHP描述顺序查找和二分查找(也叫做折半查找)算法,顺序查找必须考虑效率,对象可以是一个有序数组
f3写一个二维数组排序算法函数,能够具有通用性,可以调用php内置函数
【附答案】(以下答案不一定是最好的,只是一个简单的参考)
一、基础题
1相等相等不相等2truetruetruetruetruefalsetruefalse3aaaaaa45015526127使用五种以上方式获取一个文件的扩展名
fu
ctio
get_ext1file_
ameretur
strrchrfile_
amefu
ctio
get_ext2file_
ameretur
substrfile_
amestrrposfile_
amefu
ctio
get_ext3file_
ameretur
array_popexplodefile_
amefu
ctio
get_ext4file_
ameppathi
fofile_
ameretur
pexte
sio
fu
ctio
get_ext5file_
ameretur
strrevsubstrstrrevfile_
ame0strposstrrevfile_
ame
f二、算法题
1使用PHP描述冒泡排序和快速排序算法,对象可以是一个数组
冒泡排序(数组排序)fu
ctio
bubble_sortarray
cou
tcou
tarrayifcou
t0retur
false
fori0icou
tiforjcou
t1jijifarrayjarrayj1tmparrayjarrayjr