Which keyword is used to output text in PHP?
A
write B
echo C
output D
display
Analysis & Theory
In PHP, `echo` is used to output text to the browser.
Which keyword can also be used to output text, apart from `echo`?
A
print B
say C
display D
output
Analysis & Theory
`print` is also used in PHP to output text, similar to `echo`.
What is the output of the following code?
```
<?php
echo 'Hello';
echo ' World';
?>
```
A
HelloWorld B
Hello World C
Hello D
Error
Analysis & Theory
`echo` outputs both strings consecutively, resulting in `Hello World`.
What is the difference between `echo` and `print` in PHP?
A
`echo` can take multiple parameters; `print` cannot. B
`print` returns a value (1); `echo` does not. C
`echo` is slightly faster than `print`. D
All of the above
Analysis & Theory
All are correct. `echo` is faster, accepts multiple parameters, while `print` returns a value.
Which of the following is the correct way to output 'Hello World' in PHP?
A
echo 'Hello World'; B
print 'Hello World'; C
echo("Hello World"); D
All of the above
Analysis & Theory
All are valid ways to output text in PHP using `echo` or `print`.
How many values can `echo` output at once (using commas)?
A
Only one B
Only two C
Multiple values D
Zero
Analysis & Theory
`echo` can output multiple values when separated by commas like `echo 'Hello', ' World';`.
What is the output of the following?
```
<?php
print 'Hello';
?>
```
A
Hello B
Error C
1 D
Print Hello
Analysis & Theory
`print` outputs `Hello` to the screen.
What value does `print` return in PHP?
A
0 B
1 C
True D
False
Analysis & Theory
`print` always returns 1, which can be useful in expressions.
What is the output of this code?
```
<?php
echo 'Hello' . ' World';
?>
```
A
HelloWorld B
Hello World C
Error D
Hello.World
Analysis & Theory
The dot `.` is used for string concatenation in PHP, so it outputs `Hello World`.
Which statement is true about `echo` in PHP?
A
`echo` is a function that requires parentheses. B
`echo` is a language construct and does not require parentheses. C
`echo` cannot output strings. D
`echo` can only output numbers.
Analysis & Theory
`echo` is a language construct, not a function. Parentheses are optional but can be used.