is_array detects an array and returns false

WBOY
Release: 2016-08-08 09:06:53
Original
988 people have browsed it

<code>echo $res;
var_dump($res);
var_dump(is_array(res));</code>
Copy after login
Copy after login

$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>
Copy after login
Copy after login

Is it because of the php configuration?

Reply content:

<code>echo $res;
var_dump($res);
var_dump(is_array(res));</code>
Copy after login
Copy after login

$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>
Copy after login
Copy after login

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

Related labels:
php
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!