The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.
I'm sure I'm being ridiculously stupid, but say I define varaible $name to Alex, then want to link to root.com/$name.
Now, what I think I should be doing is simple: LINK
What's wrong? Why doesn't it work?
I keep getting unexpected T_string etc... I know I'm missing something, but what?
http://root.com/
Cheers :D.
You use it to join two strings together, or to add one string to another, e.g:
$var = "foo";
$var .= "bar";
echo $var; // Would print: foobar
The + sign is used to add two numbers together, e.g.:
$var = 2+3;
echo $var; // Would print: 5
or similarly as above:
$var = 2;
$var += 3;
echo $var; // Would print: 5
> LINK
>
> Not that it really matters, but wouldn't it be better practice to
> do...
>
> echo(' > href="http://root.com/'.$name.'">LINK');
Well, actually, it would be better practice to define $rootname and have echo($rootname).
Nyah. :D
But actually, if I were to want to echo or print two variables would I write echo('$var1''$var2')? Or 'var1'+'var2' ?
> Not that it really matters, but wouldn't it be better practice to
> do...
No.
It's actually better to make less use of the echo statement, keeping HTML outside of php sections.
Usually that error means that you haven't put a semicolon or closing bracket on the line before, therefore it doesn't expect an echo statement.
I'm sure I'm being ridiculously stupid, but say I define varaible $name to Alex, then want to link to root.com/$name.
Now, what I think I should be doing is simple: LINK
What's wrong? Why doesn't it work?
I keep getting unexpected T_string etc... I know I'm missing something, but what?