PHP echo() Function

PHP echo() function is important string function. It is used to display one or more strings. In another words we can say that the echo() function outputs one or more string.

Note: The echo() function is a little faster than print().

Syntax:

ParameterDescriptionRequired/Optional
stringsSpecify one or more stringsrequired

Example 1

Output:

By using 'echo()' function your string is :Hello JavaTpoint

Example 2

Output:

By using 'echo()' function your string is :Hello JAVA
Hello JavaTpoint

Example 3

Output:

Your Shirt color is : Red

Note: The shortcut syntax only works with the short_open_tag configuration setting enabled.

Example 4

Output:

Your number value is: (1 + 2)
By using 'echo()' function: Addition value is: 3

Example 5

Output:

Hello John Doe!

Example 6

Output:

Your string is : 'This ','string ','was ','made ','with multiple parameters.'
This string was made with multiple parameters.

Example 7

Output:

Peter is 35 years old.

Next TopicPHP String




Latest Courses