Home > Article > Backend Development > How to determine whether it is an array in php
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.
#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!