I am new to php and trying to do this:
<html>
<body>
<?php
echo 'Welcome'.$_GET['name'];
?>
</body>
</html>
This is my php code which displays my name entered by using a html form. When submit button is pressed I get this output :- WelcomeNick Watterson
But I am trying to add space between Welcome and Nick. How can I do this in this code?
use the below code
<?php
echo 'Welcome '.$_GET['name'];
?>
is the html entity code for creating an single space character.
You can also use the below code:
<?php
echo 'Welcome '.$_GET['name'];
?>
Will also work because one empty space is interpreted by the browsers directly.
<?php
$strings = array('Hello', 'World!');
// Usual concatenation
echo $strings[0] . ' ' . $strings[1];
// Some implode
echo implode(' ', $strings);