Home > Backend Development > PHP Tutorial > is_array detects an array and returns false

is_array detects an array and returns false

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-08-08 09:06:53
Original
1053 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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template