GetDotted Domains

Viewing Thread:
"PHP Stupidity"

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.

Fri 03/06/05 at 14:43
Regular
"Bicycle"
Posts: 4,899
Grr.

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?
Mon 06/06/05 at 12:27
Regular
"Eff, you see, kay?"
Posts: 14,156
Short syntax:

http://root.com/
Sun 05/06/05 at 09:08
Regular
"Bicycle"
Posts: 4,899
Oh right. Makes a lot of sense now...

Cheers :D.
Sat 04/06/05 at 17:29
Regular
"NULL"
Posts: 1,384
It's the concatenation operator in PHP.

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
Sat 04/06/05 at 17:18
Regular
"Bicycle"
Posts: 4,899
What does the "." do?
Sat 04/06/05 at 11:21
Regular
"NULL"
Posts: 1,384
Fri 03/06/05 at 23:32
Regular
"Bicycle"
Posts: 4,899
Damarus wrote:
> 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' ?
Fri 03/06/05 at 15:37
Regular
Posts: 10,364
Damarus wrote:
> 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.
Fri 03/06/05 at 15:02
Regular
Posts: 4,279
LINK

Not that it really matters, but wouldn't it be better practice to do...

echo('LINK');
Fri 03/06/05 at 14:54
Regular
"NULL"
Posts: 1,384
There's nothing wrong with that and it works fine when I just tested your exact code.

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.
Fri 03/06/05 at 14:43
Regular
"Bicycle"
Posts: 4,899
Grr.

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?

Freeola & GetDotted are rated

Check out some of our customer reviews below:

Many thanks!!
Registered my website with Freeola Sites on Tuesday. Now have full and comprehensive Google coverage for my site. Great stuff!!
John Shepherd
I've been with Freeola for 14 years...
I've been with Freeola for 14 years now, and in that time you have proven time and time again to be a top-ranking internet service provider and unbeatable hosting service. Thank you.
Anthony

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre
Feedback Hide Feedback Tab

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.