孤独海岸线 发表于 2017-4-3 11:01:06

12道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 ?

  $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]
查看完整版本: 12道PHP类型检测题目