Echo and Print Statement in PHP
In PHP there are two ways to get output:
- Echo Statement.
- Print Statement.
1) PHP Echo Statement
- Echo statement can display anything on the browser, such as string, numbers, variables values etc. or You can say the echo statement can output one or more strings.
- echo has no return value .
- echo statement can be used with or without parentheses: echo or echo().
Example :-
Output
This is Job Portal Website
rojgarbharat.info
5
2) PHP Print Statement
- Print statement can display anything on the browser, such as string, numbers, variables values etc
- print has a return value of 1 so it can be used in expressions.
- print statement can be used with or without parentheses: print or print().
Example :-
Output
rojgarbharat.info!
123456789
Red
|