Re: incrememnting an array

From: Date: Fri, 20 Sep 2002 09:41:39 +0000
Subject: Re: incrememnting an array
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-21865@lists.php.net to get a copy of this message
I hope the little script bellow helps you greet Martin <? $arr = array('a','b','c','d','e','f','g','h'); $arr2[] = $x = array_shift($arr); $arr2[] = $y = array_shift($arr); $arr2[] = $y; while($arr) { $arr2[] = $x.$y .= array_shift($arr); $arr2[] = $x.$y; } echo implode(',',$arr2); echo '<pre>'; print_r($arr2); echo '</pre>'; ?> ----- Original Message ----- From: "John Coder" <jcoder@insightbb.com> To: <php-db@lists.php.net> Sent: Friday, September 20, 2002 8:19 AM Subject: [PHP-DB] incrememnting an array hi all this is what I would like to do. I have a dynamically generated array from a database and I wnat to do a piechart from it . for example the array would hold (a,b,c,d,e,f,g,h) sometimes more sometimes less . I need to get the values of a,b,b,a+b,a+b,a+b+c,a+b+c,a+b+c+d, and son on these are for the values of the angles for the pie chart on imagefilledarc(). And for the life of me I can't figure out how to do it. any help would be greatly appreciated John Coder -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.db (#21865) next »