How Different Echo & Print in PHP

→ There are two statement in PHP are ‘echo’ and ‘print’. Both are used to display the output in PHP.

→ Most faster in PHP is ‘echo’, ‘print’ is slower than ‘echo’.

Echo

Example

Output

Hello World!

→ In the above create variable is ($anytex) hold a string value=”Hello World!”. We want to print the anytext for this ($anytex) variable declare inside the echo with or without parentheses .

Print

→ This is slower than ‘echo’.

Example

Output

Hello World!

→ In the above ‘print’ create variable is ($anytex) hold a string value=”Hello World!”. We want to print the anytext for this ($anytex)  inside print statement with or without parentheses.

SHARE :

Leave a Reply

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