<?php $color1 = red;
$color2 = green;
echo $color1 + $color2;
?>
redgreen
red green
0
error
C. 0
1800
3600
1440
1540
<?php $i = 0;
while ($i = 10){ print hi;
}print hello;
?>
hello
infinite loop
hihello
error
<?php $i = 2;
while (++$i){ while (--$i > 0) print $i;
} ?>
210
10
no output
infinite loop
<?php $i = 2;
while (++$i){ while ($i --> 0) print $i;
} ?>
210
10
no output
infinite loop
start_session()
session_start()
session_begin()
begin_session()
Session
Cookie
URL rewriting
Nothing happens
360
180
3600
1800
<?php $a1 = array(red, green);
$a2 = array(blue, yellow);
print_r(array_merge($a1, $a2));
?>
Array ( [0] => red [1] => green)
Array ( [0] => blue [1] => yellow [2] => red [3] => green )
Array ( [0] => red [1] => green [2] => blue [3] => yellow )
Array ( [0] => blue [1] => yellow )
<?php $color1 = red;
$color2 = 1;
echo $color1 + $color2;
?>
red1
red 1
0
1
<?php $color1 = 1;
$color2 = 1;
echo $color1 + $color2;
?>
11
2
0
1
<?php $a = array(a=>red, b=>green, c=>blue);
echo array_shift($a);
print_r ($a);
?>
green
red
redArray( [c] => green [c] => blue )
redArray( [b] => green [c] => blue )
<?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_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 define(__LINE__, PHP is a scripting language);
echo __LINE__;
?>
PHP is a scripting language
__LINE__
2
ERROR
A PHP script should start with ___ and end with ___:
< php >
< ? php ?>
<?php ?>
<% %>
PHP files have a default file extension of..
.html
.xml
.php
.ph
.asp
.jsp
Complete text representation of month
Day of month, with leading zero
Daylight saving time
Day of month, without zeros
<?php $cars = array(Volvo, BMW, Toyota);
echo I like . $cars[0] . , . $cars[1] . and . $cars[2] . .;
?>
I like Volvo BMW and Toyota.
I like Volvo, BMW and Toyota)
I like Volvo, BMW and Toyota.
I like. Volvo.,. BMW. and. Toyota)
<?php $color = red;
echo $color . red ;
?>
red red
red
error
nothing
lastmod()
getlastmod()
last_mod()
get_last_mod()
What will be the output of the following code?
<?php
$foo = 'Bob';
$bar = &$foo;
$bar = "My name is $bar";
echo $bar;
echo $foo;
?>
Error
My name is BobBob
My name is BobMy name is Bob
My name is Bob Bob
3600 sec
3600 min
3600 hrs
the browser is restarted
<?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 class Constants{ define('MIN_VALUE', '0.0');
define('MAX_VALUE', '1.0');
public static function getMinValue() { return self::MIN_VALUE;
} public static function getMaxValue() { return self::MAX_VALUE;
}}echo Constants::getMinValue();
echo Constants::getMaxValue();
?>
0.01.0
01
No output
ERROR
Integer
String
Boolean
Float
<?php $color1 = red;
$color2 = green;
echo $color1 . $color2;
?>
red
green
red green
redgreen
<?php printf( date(t) ) ?>
30
22
JUNE
2013
<?php $color1 = red;
$color2 = green;
echo $color1.$color2;
?>
red green
red
green
error
<?php $i = 0;
while(++$i || --$i){ print $i;
} ?>
1234567891011121314….infinitely
01234567891011121314…infinitely
1
0
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)