Home > Backend Development > PHP Tutorial > php奇怪问题

php奇怪问题

WBOY
Release: 2016-06-23 14:31:01
Original
836 people have browsed it

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为弱类型语言,所以会将字符串的数字转化为整型。

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template