Sleeper Posted April 6, 2008 Share Posted April 6, 2008 If I have $a = 1 $b = 00 How would I place the two together to make 100? $a$b didnt work..lol I know im a nube just not sure how I would be able to put to var together to read as one. Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted April 6, 2008 Share Posted April 6, 2008 You need the concatenation operator (.). It joins strings together. <?php $a = 1; $b = 00; echo $a.$b; ?> Quote Link to comment Share on other sites More sharing options...
Sleeper Posted April 6, 2008 Author Share Posted April 6, 2008 thank you. Quote Link to comment Share on other sites More sharing options...
Barand Posted April 6, 2008 Share Posted April 6, 2008 $b needs to be a string otherwise it is treated as just 0 <?php $a = '1'; $b = '00'; echo "$a$b"; //or echo $a.$b; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.