🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
[TOC] ### 笔试也是考察你技术水平的——呵呵 #### 1.两个日期之间相差的小时? ``` $hour=floor((strtotime($enddate)-strtotime($startdate))%86400/3600); ``` #### 2.字符串转数组及数组转字符串的函数分别是? ``` implode 使用一个字符串将数组变成字符串 explode — 使用一个字符串分割另一个字符串,返回一个数组 ``` #### 3.请写出php5的构造函数和析构函数? ``` ``` ``` __construct() __destruct() ``` #### 4写出下面程序运行结果 ``` $a1= null; $a2=false; $a3=0; $a4=''; $a5='0'; $a6='null'; $a7=array(); $a8=array(array()); echo empty($a1)?'true':'false';true echo empty($a2)?'true':'false';true echo empty($a3)?'true':'false';true echo empty($a4)?'true':'false';true echo empty($a5)?'true':'false';true echo empty($a6)?'true':'false';false echo empty($a7)?'true':'false';true echo empty($a8)?'true':'false';false ``` #### 5写出下面程序输出多少? ``` $arr=array(5=>1,12=>5); $arr[]=56; $arr["x"]=42; $arr[]=54; echo var_dump($arr); array(5) { [5] => int(1) [12] => int(5) [13] => int(56) ["x"] => int(42) [14] => int(54) } ``` #### 6写出下面代码输出是 ``` $rest=substr('abcdef', -1); echo $rest."\n"; f $rest=substr('abcdef',0,-1); echo $rest; abcde ``` #### 7 写出下面函数运行结果? ``` $somevar=15; function addit(){ GLOBAL $somevar; $somevar++; echo "somevar is $somevar"; } addit() somevar is 16 ```