Menu Home

print

osbo.com | PHP | Functions | print

Output a string

print is a language construct, not a function, so parentheses are not required.

Syntax

print ( string $arg ) : int

Parameters

arg

The input data.

Return

Returns 1, always.

Examples

1

Hello World!

2

without parentheses

3

spans
multiple lines - newlines
are also
output

4

spans
multiple lines - newlines
are also
output

5

escaping characters: "like this"

6

variable with double quotes: variable

7

variable with single quotes: $var

8

array: value

9

This uses the "here document" syntax to output
multiple lines with variable interpolation. Note
that the "here document" terminator must appear on a
line with just a semicolon no extra whitespace!

PHP