note 126297 added to language.types.array

From: Date: Sat, 31 Jul 2021 13:40:29 +0000
Subject: note 126297 added to language.types.array
Groups: php.notes 
Request: Send a blank email to php-notes+get-216701@lists.php.net to get a copy of this message
to know the depth (dimension) of a ARRAY, you can use this: function Dim_Ar($A, $i){ if(!is_array($A))return 0; $t[] = 1; foreach($A AS $e)if(is_array($e))$t[] = Dim_Ar($e, ++ $i) + 1; return max($t); } and use with: $Q = ARRAY(ARRAY(ARRAY()), ARRAY(ARRAY()));// here depth/dimension is three echo Dim_Ar($Q, 0); ---- Server IP: 45.112.84.4 Probable Submitter: 45.112.85.242 (proxied: 2800:484:a784:a139:7c63:d419:3c2b:3e2f) ---- Manual Page -- https://php.net/manual/en/language.types.array.php Edit -- https://main.php.net/note/edit/126297 Del: integrated -- https://main.php.net/note/delete/126297/integrated Del: useless -- https://main.php.net/note/delete/126297/useless Del: bad code -- https://main.php.net/note/delete/126297/bad+code Del: spam -- https://main.php.net/note/delete/126297/spam Del: non-english -- https://main.php.net/note/delete/126297/non-english Del: in docs -- https://main.php.net/note/delete/126297/in+docs Del: other reasons-- https://main.php.net/note/delete/126297 Reject -- https://main.php.net/note/reject/126297 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#216701) next »