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

How to determine whether it is an array in php

藏色散人
藏色散人Original
2021-12-09 10:38:215615browse

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';
}

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!

Statement:
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