Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
combining mutliple msg values
Old 10-22-2008, 12:08 PM combining mutliple msg values
Skilled Talker

Posts: 69
Trades: 0
Hey all,

I forgot how to combine multiple values.

Code:
$msg="Hello";

$msg=$msg+"<br>World";

<?php echo $msg; ?>
Output:

Hello
World

Thanks,
__________________
Matt
webmaster of
Please login or register to view this content. Registration is FREE
- Online wedding planning
weddingm is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-22-2008, 12:12 PM Re: combining mutliple msg values
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
$msg .= "<br>World"
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-22-2008, 12:17 PM Re: combining mutliple msg values
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
In PHP . is used for concatination. Personally I would prefer + be the operator for combining strings as it is in java, maybe somewhere along the line they'll incorporate C++ operator redefining. Anyways... here's the code:
PHP Code:
<?php
$msg 
'Hello';
$msg .= '<br />World';

echo 
$msg;
?>
$msg .= 'world' is a shortcut for $msg = $msg . 'world'. Also in the code you posted you did not put all of your code within the start and end tags ( <?php ?> )

Edit:
I guess chrishirst beat me to it. You win this time
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Last edited by NullPointer; 10-22-2008 at 12:19 PM..
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Reply     « Reply to combining mutliple msg values
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11815 seconds with 12 queries