$var =39;
echo settype($var,"string");运行结果怎么会是1 ,求详解

解决方案 »

  1.   

    settype
    (PHP 3, PHP 4 )settype -- Set the type of a variable
    Description
    bool settype ( mixed var, string type)
    Set the type of variable var to type. Possibles values of type are: 
    "boolean" (or, since PHP 4.2.0, "bool") "integer" (or, since PHP 4.2.0, "int") "float" (only possible since PHP 4.2.0, for older versions use the deprecated variant "double") "string" "array" "object" "null" (since PHP 4.2.0) 
    如果成功则返回 TRUE,失败则返回 FALSE。 
      

  2.   

    LuciferStar  能用国语解释一下吗?
      

  3.   

    echo true;//结果是1就是你问题的原因true是php的boolean关键字,输出前被转为1了
      

  4.   

    settype($var,"string");  这句意思不是说将变量$var 转为自符串型吗?
      

  5.   

    $var =39;
    echo settype($var,"string"); // 1 表示成功var_dump($var); //string(2) "39"