note 100355 added to book.array

From: Date: Sun, 10 Oct 2010 22:38:34 +0000
Subject: note 100355 added to book.array
Groups: php.notes 
Request: Send a blank email to php-notes+get-173121@lists.php.net to get a copy of this message
perform a set of operations on each set element of a multi-dimensional array no matter the size. (I posted before but grabbed the wrong snippit. Please use this and delete the commentary here.) function dCount($mdArray) { //* $baseType = gettype($mdArray); //* if($baseType == 'array') { //* $count = 0; //* $type = $baseType; //* while($type == 'array') { //* $mdArray = current($mdArray); $type = gettype($mdArray); $count++; //* } //* } else return false; //*/// return $count; //*/// } function mdArray($array) { $baseType = gettype($array); $baseCount = count($array); //print 'BaseCount: ' . $baseCount . '<br>'; for($x = 0; $x < $baseCount; $x++) { //* if(gettype(current($array)) == 'array') { //* $drop = current($array); //* $dCount = $this->dCount($drop); //* $count = count($drop); //print '<br>' . $dCount . ' * ' . $count . '<br>'; //* for($z = 0; $z < $dCount; $z++) { //* $count = count($drop); //* for($y = 0; $y < $count; $y++) { //*CODE HERE -------------------------*** print current($drop) . '/'; //* next($drop); //* } //* print '<br>'; //* $drop = reset($drop); //* } //* } else print 'duplicate code here'; //* next($array); //* } //* } ---- Server IP: 208.69.120.55 Probable Submitter: 67.174.228.162 ---- Manual Page -- http://www.php.net/manual/en/book.array.php Edit -- https://master.php.net/note/edit/100355 Del: integrated -- https://master.php.net/note/delete/100355/integrated Del: useless -- https://master.php.net/note/delete/100355/useless Del: bad code -- https://master.php.net/note/delete/100355/bad+code Del: spam -- https://master.php.net/note/delete/100355/spam Del: non-english -- https://master.php.net/note/delete/100355/non-english Del: in docs -- https://master.php.net/note/delete/100355/in+docs Del: other reasons-- https://master.php.net/note/delete/100355 Reject -- https://master.php.net/note/reject/100355 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#173121) next »