Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.