What is the difference between print() and echo()?
print() can be used as part of an expression, while echo() can't
echo() can be used as part of an expression, while print() can't
echo() can be used in the CLI version of PHP, while print() can't
print() can be used in the CLI version of PHP, while echo() can't
What is displayed when the following script is executed?
define(myvalue, "10"); $myarray[10] = "Dog"; $myarray[] = "Human"; $myarray['myvalue'] = "Cat"; $myarray["Dog"] = "Cat"; print "The value is: "; print $myarray[myvalue]."\\n";
The value is: Dog
The value is: Cat
The value is: Human
The value is: 10
Which of the following is not valid PHP code?
$_10
${"MyVar"}
&$something
$10_somethings
Which of the following tags is not a valid way to begin and end a PHP code block?
= ?>
When turned on, __________ will __________ your script with different variables from HTML forms and cookies.
show_errors, enable
show_errors, show
register_globals, enhance
register_globals, inject
What is the value of $result in the following PHP code?
function timesTwo($int) { $int = $int * 2; } $int = 2; $result = timesTwo($int);
0
2
4
NULL
Which of the following prints ‘text/xml’?
print substr($text, strchr($text, ':'));
print substr($text, strchr($text, ':') 1);
print substr($text, strpos($text, ':') 1);
print substr($text, strpos($text, ':') 2);
What does echo count (“123?) print out?
3
false
null
1
Which of the following snippets prints a representation of 42 with two decimal places?
printf("%.2d\n", 42);
printf("%1.2f\n", 42);
printf("%1.2u\n", 42);
none of the above
Which of the following expressions multiply the value of the integer variable $a by 4?
$a *= pow (2, 2);
$a >>= 2;
$a <<= 2;
$a = $a $a;