php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36195 Variable should be $i not i
Submitted: 2006-01-28 23:06 UTC Modified: 2006-01-30 18:21 UTC
From: djshuman at yahoo dot com Assigned:
Status: Closed Package: Website problem
PHP Version: Irrelevant OS: Any
Private report: No CVE-ID: None
 [2006-01-28 23:06 UTC] 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];  



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-01-30 18:21 UTC] nlopess@php.net
fixed
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Jun 18 11:00:02 2026 UTC