[PHP] Sorting and foreach of MultiDimensional Array failing
In the following code, I'm reading a variable set of random numbers into a multi-dimensional array. The first iteration runs properly, but when I get to my 2nd+ iteration, I get the following errors; Warning: Wrong datatype in sort() call in /home/usrlinux/WWW/pballs.php on line 18 Warning: Invalid argument supplied for foreach() in /home/usrlinux/WWW/pballs.php on line 19 Is there a specific function for sorting and foreach statements of multidimensional arrays? If so, why does it work properly for the first interation,i.e. sort($num_array[1]) then subsequently fail on sort($num_array[2]) Thank you in advance! ? srand ((double) microtime() * 100); $totnum = 5; $min = 1; $max = 49; $tickcount=1; $num_array = array(); array_push($num_array, array()); echo Now Generating $tickets Tickets!br\n; while ($tickcount = $tickets) { while ( $numbercount $totnum) { $num_array[$tickcount][] = rand($min,$max); $numbers = array_unique($num_array[$tickcount]); $numbercount = count($num_array[$tickcount]); } sort($num_array[$tickcount]); foreach($num_array[$tickcount] as $val) { echo img src=ball.php?text=$valcolor=greynbsp;nbsp; } $pb[$tickcount] = rand(1,42); print img src=ball.php?text=$pb[$tickcount]color=red; $tickcount++; } ? ___ James C. Montz James Tower http://www.jamestower.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Random PowerBall Generator
More as an exercise to get back into the swing of PHP, I have created the PowerBall number generator. (for those of you un-aware, the powerball is at $200 mil). Took me a while to figure out using arrays, and the array_unique function. It also incorporate the imagepng function. Thanks to CC Zona for pointing me to the function I needed to get the job done! The page is at http://www.usrlinux.com/pball.php Source code is available for viewing. Suggestions on cleaning up code welcome. Enjoy! James ___ James C. Montz James Tower http://www.jamestower.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Not allowing same value in array. Example requested
Can someone show me how I could walk through each value (a random number) in an array to make sure no 2 are the same? I'm basically just trying to generate a random number generator. I'm just looking to create 10 numbers, none of which can be duplicates. Thank you in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] PHP Security
I found a great windows PHP IDE called PHP Coder. Reminds me a bit of ColdFusion Studio. The website is http://www.phpide.de -Original Message- From: Ray Parish [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 18, 2001 5:54 PM To: [EMAIL PROTECTED] Subject: [PHP] PHP Security Hey All, For a virtual hosting stand point, which is better to run, the module or the cgi version of php? Can you also explain why one is better than the other..? Thanks Ray Parish, RHCE -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] search for a better php source code viewer
I have been using PHP Coder as I am somewhat familiar with the ColdFusion IDE (CF Studio) http://www.phpide.de/ -Original Message- From: scott [gts] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 26, 2001 4:32 PM To: php Subject: RE: [PHP] search for a better php source code viewer im a textpad fan. (for windows) http://textpad.com/ it supports custom syntax hilighting, line numbers, and a ton of other features that i use :) -Original Message- From: Tyler Longren [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 26, 2001 10:26 AM To: [EMAIL PROTECTED]; php Subject: Re: [PHP] search for a better php source code viewer I suggest ConTEXT. It's free, and it's for windows. http://www.fixedsys.com/context And for Linux, I suggest Nedit. http://www.nedit.org/ Tyler -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]