#36195 [Opn->Csd]: Variable should be $i not i

From: Date: Mon, 30 Jan 2006 17:21:02 +0000
Subject: #36195 [Opn->Csd]: Variable should be $i not i
References: 1  Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-30523@lists.php.net to get a copy of this message
ID: 36195 Updated by: nlopess@php.net Reported By: djshuman at yahoo dot com -Status: Open +Status: Closed Bug Type: Website problem Operating System: Any PHP Version: Irrelevant New Comment: fixed Previous Comments: ------------------------------------------------------------------------ [2006-01-28 23:06:30] djshuman at yahoo dot com Description: ------------ To graph correctly from + or - zero the i variable must be changed to $i. Old ====> $min_x = $graph_x[i]; New ====> $min_x = $graph_x[$i]; Reproduce code: --------------- help at nanomc dot com 08-Nov-2005 02:29 // A simple XY graph <html> <head> <title>XY Graph</title> <h2>Practice XY Graph</h2> </head> <body> <?php $left = 0; $top = 0; $x_size = 400; $y_size = 400; $char_width = 8; $char_height = 11; $x_start = $x_left + 100; $y_start = $top + $char_height * 1.5; $x_end = $x_start + $x_size; $y_end = $y_start + $y_size; $right = $x_start + $x_size + 40; $bottom = $y_start + $y_size + $char_height * 1.5; $graph_n = 100; for($i = 0; $i < $graph_n; $i++ ) { $graph_x[$i] = $i; $graph_y[$i] = $i * $i; } $min_x = 9e99; $min_y = 9e99; $max_x = -9e99; $max_y = -9e99; $avg_y = 0.0; for($i = 0; $i < $graph_n; $i++ ) { if( $graph_x[$i] < $min_x ) New ======> $min_x = $graph_x[i]; ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36195&edit=1

« previous php.mirrors (#30523) next »