<?php $color1 = red;
$color2 = red;
echo $color1 + $color2;
?>
redgreen
red green
0
1
<?php $i = 5;
while (--$i > 0 && ++$i){ print $i;
} ?>
5
555555555…infinitely
54321
error
Integer
String
Boolean
Float
<?php printf( date(t) ) ?>
30
22
JUNE
2013
<?php $color = red;
$color = green;
echo $color;
?>
red
green
red green
error
3
4
5
6
360
180
3600
1800
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)
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 $a1 = array(a=>red, b=>green, c=>blue, d=>yellow);
$a2 = array(e=>red, f=>green, g=>blue);
$result = array_diff($a1, $a2);
print_r($result);
?>
Array ( [d] => yellow )
Array ( [c] => blue )
Array ( [a] => red )
Array ( [e] => yellow )
<?php $i = 0;
while ($i = 10){ print hi;
}print hello;
?>
hello
infinite loop
hihello
error
<?php define('IF', 42);
echo IF: , IF;
?>
IF:42
No output
IF:
ERROR
<?php define('GREETING_TEST', 'PHP is a scripting language', true);
echo GREETING_TESt;
$changing_variable = 'test';
echo constant('GREETING_' . strtoupper($changing_variable));
?>
PHP is a scripting language
GREETING_TESt
PHP is a scripting language
GREETING_TEST
<?php $color1 = 1;
$color2 = 1;
echo $color1 + $color2;
?>
11
2
0
1
PHPSESSID
PHPSESID
PHPSESSIONID
PHPIDSESS
<?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 $color1 = red;
$color2 = green;
echo $color1 . $color2;
?>
red
green
red green
redgreen
<?php $color1 = red;
$color2 = 1;
echo $color1 + $color2;
?>
red1
red 1
0
1
<?php define(__LINE__, PHP is a scripting language);
echo __LINE__;
?>
PHP is a scripting language
__LINE__
2
ERROR
<?php $color1 = red;
$color2 = green;
echo $color1.$color2;
?>
red green
red
green
error
start_session()
session_start()
session_begin()
begin_session()
Which of the following is/are a PHP code editor?
i) Notepad
ii) Notepad++
iii) Adobe Dreamweaver
iv) PDT
Only iv)
All of the mentioned.
i), ii) and iii)
Only iii)
<?php $color1 = red;
$color2 = 1;
$color3 = greyecho $color1 + $color2 . $color3;
?>
1grey
grey
0
red1grey
PHP files have a default file extension of..
.html
.xml
.php
.ph
.asp
.jsp
Session
Cookie
URL rewriting
Nothing happens
<?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
time()
mktime()
mrtime()
mtime()
What does PHP stand for?
i) Personal Home Page
ii) Hypertext Preprocessor
iii) Pretext Hypertext Processor
iv) Preprocessor Home Page
Both i) and iii)
Both ii) and iv)
Only ii)
Both i) and ii)
<?php $color = red;
echo $color . red ;
?>
red red
red
error
nothing