0% found this document useful (0 votes)
234 views2 pages

Questions

The document contains code snippets in PHP demonstrating variable assignment and data types, switch statements, functions, arrays, references, and if/elseif/else statements. It also includes a MySQL query asking how many rows would be returned by counting the number of unique values in column y, grouped by column z, having a count greater than 1.

Uploaded by

sukanyas111
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
234 views2 pages

Questions

The document contains code snippets in PHP demonstrating variable assignment and data types, switch statements, functions, arrays, references, and if/elseif/else statements. It also includes a MySQL query asking how many rows would be returned by counting the number of unique values in column y, grouped by column z, having a count greater than 1.

Uploaded by

sukanyas111
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

$x = "y";

$y = "x";
$z = "a";
$$x = "z";
$$$x = "b";
echo "$x $y $z";

$x = 1;
switch ($x) {
case "0": echo "String"; break;
case 0: echo "Integer"; break;
case NULL: echo "NULL"; break;
case FALSE: echo "Boolean"; break;
case "": echo "Empty string"; break;
default: echo "Something else"; break;
}

$x = "";
switch ($x) {
case "0": echo "String"; break;
case 0: echo "Integer"; break;
case NULL: echo "NULL"; break;
case FALSE: echo "Boolean"; break;
case "": echo "Empty string"; break;
default: echo "Something else"; break;
}

What command will put a list of the CGI parameters passed from a HTML form along with there associated
values into an array called $cgi_vars?

$x = 1; $y = 2; function z ($z) { global $x; echo "$x 0 $y 0 $z"; } z(3);


$n = array();
for ($i = 0; $i < 3; $i++) {
$n[] = null;
$num = count($n);
$index =& $n[$num ? $num - 1 : $num];
$index = $i;
}
foreach ($numbers as $index) { print "$index "; }
$x = NULL;
switch ($x) {
case "0": echo "String"; break;
case 0: echo "Integer"; break;
case NULL: echo "NULL"; break;
case FALSE: echo "Boolean"; break;
case "": echo "Empty string"; break;
default: echo "Something else"; break;
}

$pen = "Raja";
$ink = &$pen;
$ink = "Hello $ink";
echo "$pen $ink";

$x = 5;
if ($x > 5) { print "Fruit"; }
elseif ($x = 6) { print "Ice cream"; }
elseif ($x < 6) { print "Vegetables"; }
else { print "Diamond"; }

With a table x (y int(10), z int(10)) having data of 1 1, 2 1, 3 4, 4 2, 5 1 (where first number is y, second number is
z (there are 5 rows of data)), what is the output of this MySQL statement "select count(y) from x group by z
having count(y) > 1;"

You might also like