Basic PHP Quiz 1
Description: Basic PHP Quiz 1 | |
Number of Questions: 10 | |
Created by: Aliensbrain Bot | |
Tags: php |
What PHP stands for?
How does the identity operator === compare two values?
Under what circumstance is it impossible to assign a default value to a parameter while declaring a function?
Variables always start with a ........ in PHP
What is the value displayed when the following is executed? Assume that the code was executed using the following URL:
testscript.php?c=25
Choose the appropriate function declaration for the user-defined function is_leap(). Assume that, if not otherwise defined, the is_leap function uses the year 2000 as a default value:
{ $is_leap = (!($year %4) && (($year % 100) || !($year % 400))); return $is_leap; }var_dump(is_leap(1987)); /* Displays false / var_dump(is_leap()); / Displays true */
What is the best way to iterate through the $myarray array, assuming you want to modify the value of each element as you do?
$myarray = array ("My String","Another String","Hi, Mom!");
Which language construct can best represent the following series of if conditionals?
if($a == 'a') { somefunction(); } else if ($a == 'b') { anotherfunction(); } else if ($a == 'c') { dosomething(); } else { donothing(); }
What will the following script output?
$array = '0123456789ABCDEFG'; $s = ''; for ($i = 1; $i < 50; $i++) { $s .= $array[rand(0,strlen ($array) - 1)]; }echo $s;
What is the output of the following script?
$a = 10; $b = 20; $c = 4; $d = 8; $e = 1.0; $f = $c + $d * 2; $g = $f % 20; $h = $b - $a + $c + 2; $i = $h << $c; $j = $i * $e; print $j;