Jump to content

T_VARIABLE error


tubs2222

Recommended Posts

Hello everyone at Php Freaks

I've been having a problem with a little lottery game of mine that i'm making. Here is the code that receieving a error.

<?

include "usernames.php";
include "numofuserbids.php";

for ($a=1; $a <= $i; $a++)
{

$tempuser = $user$a;

echo "$tempuser";

}

In the usernames.php it has in it:

<?php $user1 = tubs2222; ?><?php $user2 = abc; ?>

and in numofuserbids.php is has in it:

<? $i = 2 ?>

and finally the error that I recieve is:

Parse error: parse error, unexpected T_VARIABLE in /home/www/nationwar.awardspace.com/gamble/testing.php on line 9

what i'm trying to do is print out $user1 and $user 2

Thanks for reading and if you have any further question regarding my program then ask away.

Link to comment
https://forums.phpfreaks.com/topic/4786-t_variable-error/
Share on other sites

[!--quoteo(post=354333:date=Mar 12 2006, 05:43 PM:name=hitman6003)--][div class=\'quotetop\']QUOTE(hitman6003 @ Mar 12 2006, 05:43 PM) [snapback]354333[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I think:

[code]$tempuser = ${"user$a"};[/code]

will work.
[/quote]

Yes it worked! :) Thank You
Link to comment
https://forums.phpfreaks.com/topic/4786-t_variable-error/#findComment-16825
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.