-->

Important points about echo and print

Echo

Important points about echo and print

1.Print is a alternative statement used as an echo.

2.Print used with parenthesis() or without parenthesis.

Example:

print(variable);

print variable;

3.Print always return integer value.

4.we can't pass multiple arguments.

5.Slower than echo statements.

Example program:

<?php

$a='Hello world';

print($a);

?>

Output:Hello world

Difference between echo and print


SNo Echo Print
1 Echo is a statement which is used to display the statement. Print is also a statement is used as alternative to echo at many times to print.
2 Echo is used as paranthensis as without parenthesis. Print also used as paranthesis as without parenthesis.
3 No return value Return integer value i.e. is 1
4 We can pass multiple arguments using comma(,) We can't pass multiple arguments.
5 Echo is faster than print Slower

Post a Comment

0 Comments