php奇怪问题

WBOY
WBOYOriginal
2016-06-23 14:31:01833browse

1、$temp="010";

     $arr="10,20,30";

     if(in_array($temp,$arr)){

    echo "error";

  }

  else{

    echo "right";

  }

  输出结果为:error。

2、$arr["1"][]="hello";

   $arr["1"][]="world";

  如果按照上面的写法会报错,php为弱类型语言,所以会将字符串的数字转化为整型。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:PHP中session详解Next article:PHP图象函数