<?php $color1 = 1;
$color2 = 1;
echo $color1 + $color2;
?>
11
2
0
1
B. 2
1800
3600
1440
1540
<?php $i = 5;
while (--$i > 0 || ++$i){ print $i;
} ?>
54321111111….infinitely
555555555…infinitely
54321
5
Which of following variables can be assigned a value to it?
i) $3hello
ii) $_hello
iii) $this
iv) $This
All of the mentioned
Only ii)
ii), iii) and iv)
ii) and iv)
<?php $i = ;
while ($i = 10){ print hi;
}print hello;
?>
hello
infinite loop
hihello
error
Session
Cookie
URL rewriting
Nothing happens
<?php $i = 5;
while (--$i > 0 && ++$i){ print $i;
} ?>
5
555555555…infinitely
54321
error
A PHP script should start with ___ and end with ___:
< php >
< ? php ?>
<?php ?>
<% %>
PHPSESSID
PHPSESID
PHPSESSIONID
PHPIDSESS
<?php $i = 5;
while (--$i > 0){ $i++;
print $i;
print hello;
} ?>
4hello4hello4hello4hello4hello…..infinite
5hello5hello5hello5hello5hello…..infinite
no output
error
Integer
String
Boolean
Float
<?php /*echo Hello world;
*/ ?>
Hello world
Nothing
Error
/* Hello world */
Which of the following must be installed on your computer so as to run PHP script?
i) Adobe Dreamweaver
ii) PHP
iii) Apache
iv) IIS
All of the mentioned.
Only ii)
ii) and iii)
ii), iii) and iv)
<?php $a1 = array_fill(3, 4, blue);
$b1 = array_fill(0, 1, red);
print_r($a1);
echo
;
print_r($b1);
?>
Array ( [3] => blue [4] => blue)
Array ( [0] => red )
Array ( [4] => blue [5] => blue [6] => blue)
Array ( [0] => red )
Array ( [3] => blue [4] => blue [5] => blue [6] => blue )
Array ()
Array ( [3] => blue [4] => blue [5] => blue [6] => blue )
Array ( [0] => red )
<?php $a = array(A, Cat, Dog, A, Dog);
print_r(array_count_values($a));
?>
Array ( [A] => 2 [Cat] => 1 [Dog] => 2 )
Array ( [A] => 2 [Cat] => 2 [Dog] => 1 )
Array ( [A] => 1 [Cat] => 1 [Dog] => 2 )
Array ( [A] => 2 [Cat] => 1 [Dog] => 1)
PHP files have a default file extension of..
.html
.xml
.php
.ph
.asp
.jsp
<?php echo Today is .date(F d, Y) ?>
Today is 22 June, 2013
Today is 22-06-2013
Today is 06-22-2013
Today is June 22, 2013
<?php $color1 = red;
$color2 = 1;
$color3 = greyecho $color1 + $color2 . $color3;
?>
1grey
grey
0
red1grey
lastmod()
getlastmod()
last_mod()
get_last_mod()
<?php $fname = array(Peter, Ben, Joe);
$age = array(35, 37, 43);
$c = array_combine($fname, $age);
print_r($c);
?>
Array ( Peter Ben Joe )
Array ( [Peter] => 35 [Ben] => 37 [Joe] => 43 )
Array ( 35 37 43 )
Array ( [Peter] => 35 [Ben] => 37 [Joe] => 43 )
<?php define(__LINE__, PHP is a scripting language);
echo __LINE__;
?>
PHP is a scripting language
__LINE__
2
ERROR
start_session()
session_start()
session_begin()
begin_session()
<?php $i = 0;
while ((--$i > ++$i) - 1){ print $i;
} ?>
00000000000000000000….infinitely
-1-1-1-1-1-1-1-1-1-1…infinitely
no output
error
<?php $i = 2;
while (++$i){ while ($i --> 0) print $i;
} ?>
210
10
no output
infinite loop
<?php define('IF', 42);
echo IF: , IF;
?>
IF:42
No output
IF:
ERROR
save_data
session.save
session.save_data
session.save_handler
<?php $age = array(Peter=>35, Ben=>37, Joe=>43);
print_r(array_change_key_case($age, CASE_UPPER));
?>
Array ( [Peter] => 35 [Ben] => 37 [Joe] => 43 )
Array ( [peter] => 35 [ben] => 37 [joe] => 43 )
Array ( [PETER] => 35 [BEN] => 37 [JOE] => 43 )
Array ( [PeTeR] => 35 [BeN] => 37 [Joe] => 43 )
<?php $color1 = red;
$color2 = red;
echo $color1 + $color2;
?>
redgreen
red green
0
1
360
180
3600
1800
<?php class myObject { }define('myObject::CONSTANT', 'test');
echo myObject::CONSTANT;
?>
test
error
myObject::CONSTANT
no output
<?php $color = red;
$color = green;
echo $color;
?>
red
green
red green
error