PHP white space & line break
Notes:
White space in PHP
If there is more than one white space in a string; then browser collapses all those white spaces to a single white space. Hence to add more than one white space in between words or characters we can use html entity
- indicates non breakable white space, which adds a single space.
We can use any number of times to add more white spaces.
Example Code:
<?php
echo "Hello World!";
?>
Line break in PHP
To add line break we can use html br tag within a string.
html br tag moves the cursor to Nextline so that from there on Nextcontent can be placed or written.
Example Code:
<?php
echo "Hello World <br/>Hello World <br/>Hello World <br/><br/>";
echo "Hello World<br/>";
echo "Hello World<br/>";
echo "Hello World<br/><br/>";
echo "Hello World";
echo "<br/>Hello World";
echo "<br/>Hello World<br/><br/>";
echo "Hello World";
echo "<br/>";
echo "Hello World";
echo "<br/>";
echo "Hello World";
echo "<br/>";
echo "<br/>";
echo "Hello World","<br/>","Hello World","<br/>","Hello World","<br/><br/>";
echo "Hello World"."<br/>"."Hello World"."<br/>"."Hello World";
?>
Interview Questions:
1. PHP stands for ______________
a. Hypertext Preprocessor
b. Preprocessor Hypertext
c. Personal Home Processor
d. Personal Hypertext processor
Ans: a