PHP printed boolean value is empty, why?

后端 未结 4 846
清歌不尽
清歌不尽 2020-12-01 14:10

I am new to PHP. I am implementing a script and I am puzzled by the following:

$local_rate_filename = $_SERVER[\'DOCUMENT_ROOT\'].\"/ghjr324l.txt\";
$local_r         


        
4条回答
  •  抹茶落季
    2020-12-01 14:34

    Be careful when you convert back and forth with boolean, the manual says:

    A boolean TRUE value is converted to the string "1". Boolean FALSE is converted to "" (the empty string). This allows conversion back and forth between boolean and string values.

    So you need to do a:

    echo (int)$local_rates_file_exists."
    ";

提交回复
热议问题