Appending strings
Moderator: General Moderators
Appending strings
How do I append strings that contain numbers for their values?
-
Illusionist
- Forum Regular
- Posts: 903
- Joined: Mon Jan 12, 2004 9:32 pm
Code: Select all
$num = 15;
$text = "Number is: ";
$text = $text . $num; //or $text .= $num
echo $text; //returns Number is: 15- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
the concatenation operator: . (period)
example:
example:
Code: Select all
<?php
$foo = 123;
$bar = 'jerry';
$baf = $foo.$bar;
echo $baf;
?>