How to Work PHP Echo keyword & Print Function

How to Work PHP Echo & Print Function [Full Tutorail]

Description:

In this tutorial we will discuss, how to output data in browser with PHP.  In PHP the two basic constructs to get outputs are echo and print. echo and print are more or less the same. They are both used to output data to the screen. The differences are small: echo has no return value while print has a return value of 1 so it can be used in expressions.

How to Work PHP Echo & Print Function

The echo Statement

Actually, echo() is not a function, it is a language construct, therefore, you can use it without parentheses. echo can take multiple parameters. echo is marginally faster than print. you can Display string, variable with echo statement.

How to Work PHP Echo & Print Function

PHP Echo & Print Function

Syntax:

echo “type text here”;

Examples:

Embend HTML with PHP:

echo can take multiple parameters.

The print() Function

print() is a function that outputs data. In most cases, anything output by print() ends up in the browser window. A function is a command that performs an action, usually modified in some way by data provided for it. Data sent to a function is almost always placed in parentheses after the function name. In this case, you sent the print() function a collection of characters, or string. Strings must always be
enclosed by quotation marks, either single or double.

Syntax:

print(“PHP Print Function”);

Examples:

Print can take one argument:

 

Contact:

Any Kind Of Help Or Needs So Contact Me:
Facebook Group: [ https://www.facebook.com/Tutorials-Ocean-185506455425271/ ]

Leave a Reply

Your email address will not be published. Required fields are marked *