Hello World

suggest change

The most widely used language construct to print output in PHP is echo:

echo "Hello, World!\n";

Alternatively, you can also use print:

print "Hello, World!\n";

Both statements perform the same function, with minor differences:

Both echo and print are language constructs, not functions. That means they do not require parentheses around their arguments. For cosmetic consistency with functions, parentheses can be included. Extensive examples of the use of echo and print are available elsewhere.

C-style printf and related functions are available as well, as in the following example:

printf("%s\n", "Hello, World!");

See Outputting the value of a variable for a comprehensive introduction of outputting variables in PHP.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents