PHP编程笔试题与.pdfVIP

  • 1
  • 0
  • 约4.71千字
  • 约 8页
  • 2026-02-03 发布于北京
  • 举报

答题者:__:

1.请写出下面的程序执行的结果(20分):

题一、?php$string=April15,2003;$pattern=/(\

w+)(\d+),(\d+)/i;$recement=$3,${1}1;echo

_

pregrece($pattern,$recement,$string);

题二、?php$array=array(0=蓝色,1=红色,2=绿色,3=红色

____

);printr(arraysearch(绿色,$array));printr(arraysearch(红色,$array));

题三、?php$json={a:1,b:2,c:{c1:100,c2:200},d:4,e:

__

5};printr(jsondecode($json));

题四、?php$s

=12345;$s[$

s[1]]=2;

echo$s;

题五、?phpclassA{functionexample(){

echo我是A::example()br/\n;}}class

BextendsA{functionexample(){echo我

是B::example()br/\n;

parent::example();}

答题者:__:

1.请写出下面的程序执行的结果(20分):

题一、

?php

$string=April15,2003;

$pattern=/(\w+)(\d+),(\d+)/i;

$recement=$3,${1}1;

echopreg_rece($pattern,$recement,$string);

?

题二、

?php

$array=array(0=blue,1=red,2=green,3=red);

print_r(array_search(green,$array));

print_r(array_search(red,$array));

?

题三、

?php

$json={a:1,b:2,c:{c1:100,c2:200},d:4,e:5};

print_r(json_decode($json));

?

题四、

?php

$s=12345;

$s[$s[1]]=2;

echo$s;

?

题五、

?php

classA{

functionexample(){

echoIamA::example()br/\n;

}

}

classBextendsA

{functionexample()

{

echoIamB::example()br/\n;

parent::example();

}

}

}

$b=new

B;$b‑

example();

2.选择题(可多选)(20分)

1)哪些返回True?

a)echo((true?true:false)?t:f);b)echo((true?0:)?true:false);c)

echo一个包含.(true)?true:false.条件的字符串。;

2)以下代码的输出?

?phpclassA{public$Id;}$a=

newA();$a‑Id=1;$array=

array($a);foreach($arrayas$

key=$value){$value‑Id=2;$

key=$value‑Id;}foreach($

arrayas$key=$value){echo$

key.=.$value‑Id;}a)0=1

b)0=2c)1=1d)1=2e)2=2

3)请看下面代码,数据库关闭指令将关闭哪个连接?

php$link1=mysql_

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档