Home > Backend Development > PHP Problem > How to determine whether it is an array in php

How to determine whether it is an array in php

藏色散人
Release: 2023-03-14 11:34:01
Original
5653 people have browsed it

php method to determine whether it is an array: 1. Create a PHP sample file; 2. Define a variable; 3. Pass "if( is_array( $a ) ){...}else{... }" method can be used to determine whether the specified variable is an array.

How to determine whether it is an array in php

#The operating environment of this article: Windows 7 system, PHP version 7.4, Dell G3 computer.

php How to determine whether it is an array?

Code example:

$a = 1;
if( is_array( $a ) ){
  echo '是数组';
}else{
   echo '不是数组0';
}
Copy after login

Determine whether the variable type is an array type.

Syntax: int is_array(mixed var);

Return value: integer

Function type: PHP system function

Content Description

If the variable is an array type, it returns true, otherwise it returns false.

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to determine whether it is an array in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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