Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#159205 - 05/05/2003 15:24 Simple Question
Dignan
carpal tunnel

Registered: 08/03/2000
Posts: 12338
Loc: Sterling, VA
I can't gleam this from the PHP manual. How do I combine strings?
Say I have these strings:
$namelast = "Doe"
$namefirst = "John"

and I want to combine them into a string like $name

I don't need for there to be a space, just a result like "DoeJohn"

How do I do that?
_________________________
Matt

Top
#159206 - 05/05/2003 15:34 Re: Simple Question [Re: Dignan]
trs24
old hand

Registered: 20/03/2002
Posts: 729
Loc: Palo Alto, CA
I believe you'd do it with a "." like this:

$name = $namelast . $namefirst;

or with a comma and a space:

$name = $namelast . ", " . $namefirst;

EDIT: Forgot my damn semi-colons. always do that.


Edited by trs24 (05/05/2003 16:43)
_________________________
- trs

Top
#159207 - 05/05/2003 15:41 Re: Simple Question [Re: Dignan]
cushman
veteran

Registered: 21/01/2002
Posts: 1380
Loc: Erie, CO
or you can format them within another string:

$newname = "$namelast$namefirst";

or

$newname = "$namelast, $namefirst";
_________________________
Mark Cushman

Top
#159208 - 05/05/2003 17:13 Re: Simple Question [Re: trs24]
Dignan
carpal tunnel

Registered: 08/03/2000
Posts: 12338
Loc: Sterling, VA
Thanks guys. I'm still brushing up on my basics. I just needed this for a particular application. Thanks again!
_________________________
Matt

Top
#159209 - 05/05/2003 19:00 Re: Simple Question [Re: Dignan]
JBjorgen
carpal tunnel

Registered: 19/01/2002
Posts: 3584
Loc: Columbus, OH
How do I combine strings


In case you want to impress your programmer friends...they'll expect you to ask "How do I concatenate strings?" In case you're still looking, here's the applicable page from the manual.
_________________________
~ John

Top