unemployment Posted February 23, 2011 Share Posted February 23, 2011 How do I add a space in my concatenation? What I have down below doesn't work. $result[0] .$result[1] Link to comment https://forums.phpfreaks.com/topic/228609-concatenation/ Share on other sites More sharing options...
Adam Posted February 23, 2011 Share Posted February 23, 2011 $result[0] . ' ' . $result[1] Link to comment https://forums.phpfreaks.com/topic/228609-concatenation/#findComment-1178686 Share on other sites More sharing options...
kenrbnsn Posted February 23, 2011 Share Posted February 23, 2011 To add a space, you have to type a literal space enclosed in quotes. <?php $str = $result[0] . ' ' . $result[1]; ?> Ken Link to comment https://forums.phpfreaks.com/topic/228609-concatenation/#findComment-1178688 Share on other sites More sharing options...
isedeasy Posted February 23, 2011 Share Posted February 23, 2011 echo $result[0] . ' ' . $result[1]; echo "{$result[0]} {$result[1]}"; Link to comment https://forums.phpfreaks.com/topic/228609-concatenation/#findComment-1178689 Share on other sites More sharing options...
unemployment Posted February 23, 2011 Author Share Posted February 23, 2011 Thanks. I know that was an easy one. Link to comment https://forums.phpfreaks.com/topic/228609-concatenation/#findComment-1178691 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.