`
richyang
  • 浏览: 70777 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
最近访客 更多访客>>
社区版块
存档分类
最新评论

12道PHP类型检测题目

    博客分类:
  • php
阅读更多

这些题目无意之中在一个网站上找到,先做做看,你能对几道?过几天再把答案公布出来!

 

PHP Skills Test

 

$a .= "a";
$a .= "b";
$a .= "c";

What is the value of $a ?

 

$a = 4;
for ($b = 0; $b <= $a; $b++) {
$c++;
}

What is the value of $c ?

 

$a[] = "a";
$a[] = "b";
$a[] = "c";

What is the value of $a[2] ?

 

$a = 200.5;
$b = 2005;
$c = "2005";

Which of the above variables's type is integrer ?
$

 

$a = '1';
$b = &$a;
$b = "2$a";

What is the value of $a ?

 

$a = "abc";
$b = substr($a, 0, -1);

What is the value of $b ?

 

$a = true;
$b = "true";
$c[] = "true";

Which of the above variables's type is string ?
$

 

$a = "b";
$b = "a";

What is the value of ${$b} ?

 

$a = array("a","b","c");
foreach ($a as $b){
$c++;
}

What is the value of $c ?

 

$a = "0";
$b = "0";
if ($a != "1" && $b == "1" || $a != "0" || $b != "1" ){
$d = "0";
}else{
$d = "1";
}

What is the value of $d ?

 

$a = "post_processed_string";
$b = array("post_", "_");
$c = array("", " ");
$d = ucwords(str_replace($b,$c,$a));

What is the value of $d ?

 

$a = "<tt>some</tt><b>html</b>";
preg_match("/<\w?>(\w*?)<\/\w?>/",$a,$b);

What is the value of $b[1] ?

16
3
分享到:
评论
3 楼 baiyuxiong 2010-09-13  
不错不错不错
2 楼 jakey9826 2010-09-09  
果然很基础。
$a = 4;
for ($b = 0; $b <= $a; $b++) {
$c++;
}

虽然PHP是弱类型语言,
但$c++这种没有初使化的情况还是会产生一个notice级别的错误。
1 楼 skynetgrp 2010-09-02  
不错的题目,做错了5道。

相关推荐

Global site tag (gtag.js) - Google Analytics