Adding multiple white areas and line breaks in PHP code is vital for data format and displaying text properly on an online page. Strings from alternative software system is also victimisation totally different spacing characters and wish to be born-again to HTML tags. sadly, some pc architectures use totally different spacing characters than others. making areas in PHP is completed principally through the “echo” perform.
Step 1
Open the PHP file in a text editor, such as Windows Notepad.
Step 2
Add a single space between PHP variables by adding the code “echo $variable1 .” “. $variable2;.”
Step 3
Add multiple spaces by adding the code “echo $variable1 .” “. $variable2;.” The ” ” entity represents a non-breaking space. Using ” ” frequently doesn’t work because web browsers collapse multiple spaces into one.
Step 4
Add a space as a line break with the code “echo “\r\n””, “echo ”
“” or “echo “\n”.” The “\n” character represents a new line and the “\r” character represents a carriage return.
Step 5
Call the PHP “nl2br” function to replace every “\r”, “\n”, “\n\r” and “\r\n” entity in a string with an HTML line break, ” ” or ”
“, by adding the code “echo nl2br(“line1\nline2″);.” This will output “line1 ” and then “” on the next line.
Step 6
Save the PHP file, close it and then load it on your server.
is used for adding space in html and php
You can add
html in between name and profession
$spName .= $row['firstname'];
$spPro = $row['profession'];
$options .= '<option value='. $spName . '' . $spPro .'>' . $row['firstname'] . ' ' . $row['lastname'] . ' - ' . $row['profession'] . '</option>';
// or i could also do it this way.
$options .= '<option value='. $row['firstname'] . ' ' . $row['profession'] .'>' . $row['firstname'] . ' ' . $row['lastname'] . ' - ' . $row['profession'] . '</option>';