Workshop

Quiz

1: Which of the following variable names is not valid?
$a_value_submitted_by_a_user
$666666xyz
$xyz666666
$_____counter_____
$the first
$file-name
2: What will the following code fragment output?
$num = 33;
(boolean) $num;
print $num;
3: What will the following statement output?
print gettype("4");
4: What will be the output from the following code fragment?
$test_val = 5.4566;
settype( $test_val, "integer" );
print $test_val;
5: Which of the following statements does not contain an expression?
4;
gettype(44);
5/12;
6: Which of the statements in question 5 contains an operator?
7: What value will the following expression return, and what data type will the returned value be?
5 < 2

Answers

A1: The variable name ...

Get Sams Teach Yourself PHP in 24 Hours, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.