Thank you for the replies guys...
Obviously I am not getting it right... I am keep getting this error message...
Notice: Undefined variable: line0 in d:\inetpub\wwwroot\php\Maybeck4.php on line 40
Notice: Undefined variable: line1 in d:\inetpub\wwwroot\php\Maybeck4.php on line 40
Notice: Undefined variable: line2 in d:\inetpub\wwwroot\php\Maybeck4.php on line 40
Notice: Undefined variable: line3 in d:\inetpub\wwwroot\php\Maybeck4.php on line 40
...
...
Besides that, I am not understanding the reasons behind this...
Let me do this and somebody help me understand this...
Let's say tha I want to create 10 variables in for loop...
line0
line1
line2
...
line8
line9
and I want to assign the value from 0 to 9 to each variables...
Can somebody tell me if I am right???
<?
for ($i = 0 ; $i < 10 ; $i++)
{
$lineVar = "line" . $i;
$theLine = ${$lineVar};
$theLine = $i;
echo("i = " . $i . "\ttheLine = " . $theLine);
}
?>
and the result is
Notice: Undefined variable: line0 in d:\inetpub\wwwroot\php\dynamicVars.php on line 6
i = 0 theLine = 0
Notice: Undefined variable: line1 in d:\inetpub\wwwroot\php\dynamicVars.php on line 6
i = 1 theLine = 1
Notice: Undefined variable: line2 in d:\inetpub\wwwroot\php\dynamicVars.php on line 6
i = 2 theLine = 2
Notice: Undefined variable: line3 in d:\inetpub\wwwroot\php\dynamicVars.php on line 6
i = 3 theLine = 3
Notice: Undefined variable: line4 in d:\inetpub\wwwroot\php\dynamicVars.php on line 6
i = 4 theLine = 4
Notice: Undefined variable: line5 in d:\inetpub\wwwroot\php\dynamicVars.php on line 6
i = 5 theLine = 5
Notice: Undefined variable: line6 in d:\inetpub\wwwroot\php\dynamicVars.php on line 6
i = 6 theLine = 6
Notice: Undefined variable: line7 in d:\inetpub\wwwroot\php\dynamicVars.php on line 6
i = 7 theLine = 7
Notice: Undefined variable: line8 in d:\inetpub\wwwroot\php\dynamicVars.php on line 6
i = 8 theLine = 8
Notice: Undefined variable: line9 in d:\inetpub\wwwroot\php\dynamicVars.php on line 6
i = 9 theLine = 9
Can somebody tell me what I am geting those error messages???
Now, I have added another for loop right below the first for loop...
for ($j = 0 ; $j < 10 ; $j++)
{
$lineVar = "line" . $j;
$theLine = ${$lineVar};
echo("j = " . $j . "\ttheLine = " . $theLine);
}
and I am not able to get the value from it...
Notice: Undefined variable: line0 in d:\inetpub\wwwroot\php\dynamicVars.php on line 12
j = 0 theLine =
Notice: Undefined variable: line1 in d:\inetpub\wwwroot\php\dynamicVars.php on line 12
j = 1 theLine =
Notice: Undefined variable: line2 in d:\inetpub\wwwroot\php\dynamicVars.php on line 12
j = 2 theLine =
Notice: Undefined variable: line3 in d:\inetpub\wwwroot\php\dynamicVars.php on line 12
j = 3 theLine =
Notice: Undefined variable: line4 in d:\inetpub\wwwroot\php\dynamicVars.php on line 12
j = 4 theLine =
Notice: Undefined variable: line5 in d:\inetpub\wwwroot\php\dynamicVars.php on line 12
j = 5 theLine =
Notice: Undefined variable: line6 in d:\inetpub\wwwroot\php\dynamicVars.php on line 12
j = 6 theLine =
Notice: Undefined variable: line7 in d:\inetpub\wwwroot\php\dynamicVars.php on line 12
j = 7 theLine =
Notice: Undefined variable: line8 in d:\inetpub\wwwroot\php\dynamicVars.php on line 12
j = 8 theLine =
Notice: Undefined variable: line9 in d:\inetpub\wwwroot\php\dynamicVars.php on line 12
It looks like the first for loop did not create those 10 variables, line0, line1, ... , line9...
Can someone tell me what I am doing wrong??? Thank you for your time... 😉