For Programmers: Free Programming Magazines  


Home > Archive > PHP Mirrors > January 2006 > #36195 [Opn->Csd]: Variable should be $i not i









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author #36195 [Opn->Csd]: Variable should be $i not i
nlopess@php.net

2006-01-30, 6:58 pm

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
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com