note 47769 added to function.strlen

From: Date: Mon, 29 Nov 2004 11:24:56 +0000
Subject: note 47769 added to function.strlen
Groups: php.notes 
Request: Send a blank email to php-notes+get-81147@lists.php.net to get a copy of this message
function array_strlen(&$array,$fuse=200,$depth=0) { // returns the strlen of all elements in a given array, an array inside // an array will add another 8 points // fuse: Recursion is limited to 200 calls, if you want unlimited calls // use fuse=0 - warning: if an array element contains a reference // to the array itself it will run endless if fuse set to 0 or below. $strlen=0; $fuse-=1; if ($fuse==0) return $strlen; if (is_array($array)) { if ($depth>0) $strlen+=8; reset($array); $depth+=1; foreach ($array as $sub) $strlen+=array_strlen($sub,$fuse,$depth); } else { $strlen+=strlen($array); } return $strlen; } // array_strlen() ---- Manual Page -- http://www.php.net/manual/en/function.strlen.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+47769 Delete -- http://master.php.net/manage/user-notes.php?action=delete+47769&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+47769&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+47769&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+47769&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+47769&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+47769&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+47769&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#81147) next »