PHP echo statement | php font color
LastupdateonAugust19202221:51:13(UTC/GMT+8hours)DescriptionInPHPthetwobasicconstructstogetoutputsareechoandprint.Actually,echo()isnotafunction,itisalanguageconstruct,therefore,youcanuseitwithoutparentheses.Displaystring,variablewithechoSyntaxecho(arg1,arg2...)Example:Simplestringdisplay; echoTwolinesimplestringexample
; echoTomorrowIlllearnPHPglobalvariables.
; echoThisisabadcommand:delc:\*.*
; ?>...
In PHP the two basic constructs to get outputs are echo and print. Actually, echo() is not a function, it is a language construct, therefore, you can use it without parentheses.
Display string, variable with echo
Syntax
echo (arg1, arg2... )Example : Simple string display
<?php echo One line simple string.<br />; echo Two line simple string example<br />; echo Tomorrow I ll learn PHP global variables.<br />; echo This is a bad command : del c:\*.* <br />; ?>All the above echo commands simply display the corresponding string, here we have used an additional html command <br /> at the end of each echo statement to generate a line break as cannot generate a line break in browser.
Example : Variable inside echo statement
&...