php method to determine the dimensionality of an array: first create a PHP sample file; then define a TestArray function; finally, traverse the foreach and "is_array" functions to determine the dimensionality of the array.
#The operating environment of this article: Windows7 system, PHP7.1, Dell G3 computer.
PHP checks whether the current array is a multi-dimensional array
/** * [TestArray 检测数组是一维还是二维] * @E-mial wuliqiang_aa@163.com * @TIME 2017-04-07 * @WEB http://blog.iinu.com.cn * @param [type] $array [数组] */ function TestArray($array){ foreach($array as $v){ if(is_array($v)){ $Int_Array = array('status'=>2,'return'=>'检测为二维数组'); }else{ $Int_Array = array('status'=>1,'return'=>'检测为一维数组'); } } return $Int_Array; }
[Recommended learning: "PHP Video Tutorial"]
The above is the detailed content of How to determine the dimensionality of an array in php. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

SublimeText3 Chinese version
Chinese version, very easy to use

Dreamweaver CS6
Visual web development tools

Notepad++7.3.1
Easy-to-use and free code editor

WebStorm Mac version
Useful JavaScript development tools
