Home >Backend Development >PHP Tutorial >is_array detects an array and returns false
<code>echo $res; var_dump($res); var_dump(is_array(res));</code>
$res is the result of the database query. If there is a result, it returns an array. If there is no result, it returns false. But now even if $res is an array, it is false. Below is the display result.
<code>Array array(3) { ["ID"]=> string(1) "1" ["USERNAME"]=> string(4) "root" ["NICKNAME"]=> string(17) "复仇者联盟~~" } bool(false)</code>
Is it because of the php configuration?
<code>echo $res; var_dump($res); var_dump(is_array(res));</code>
$res is the result of the database query. If there is a result, it returns an array. If there is no result, it returns false. But now even if $res is an array, it is false. Below is the display result.
<code>Array array(3) { ["ID"]=> string(1) "1" ["USERNAME"]=> string(4) "root" ["NICKNAME"]=> string(17) "复仇者联盟~~" } bool(false)</code>
Is it because of the php configuration?
var_dump(is_array($res));
You missed $
Feeling sorry, on the importance of syntax highlighting
Haha, this kind of little mistake is often made