note 29477 added to function.var-dump

From: Date: Fri, 14 Feb 2003 14:29:48 +0000
Subject: note 29477 added to function.var-dump
Groups: php.notes 
Request: Send a blank email to php-notes+get-43938@lists.php.net to get a copy of this message
rudigier really good graph_var_dump script (see above) only works for 4 array levels then it gives an offset error. So I modified it to support an indefinite amount of levels: function graph_var_dump($vInput, $iLevel = 0) { $bg[0] = "#DDDDDD"; $bg[1] = "#C4F0FF"; $bg[2] = "#BDE9FF"; $bg[3] = "#FFF1CA"; ... With this change array index of $bg starts with 0 and has 4 elements. You could also define 5 or more color. Now replace $bg[$iLevel] with $bg[$iLevel%sizeof($bg)]. If iLevel is 23 now the script would use $bg[3] here in this example with 4 colors (23modulo4) ergo it's cycling through the colors. -- http://www.php.net/manual/en/function.var-dump.php http://master.php.net/manage/user-notes.php?action=edit+29477 http://master.php.net/manage/user-notes.php?action=delete+29477 http://master.php.net/manage/user-notes.php?action=reject+29477

« previous php.notes (#43938) next »