<?php define('GOOD_OCTAL', 0700);
define('BAD_OCTAL', 0600);
print GOOD_OCTAL;
print '
';
print BAD_OCTAL;
?>
384
0800
ERROR
No output
A. 448
384
<?php $color1 = red;
$color2 = green;
echo $color1.$color2;
?>
red green
red
green
error
<?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
<?php define(NEW_GOOD_NAME_CONSTANT, I have a value);
define(OLD_BAD_NAME_CONSTANT, NEW_GOOD_NAME_CONSTANT);
�echo NEW_GOOD_NAME_CONSTANT;
echo OLD_BAD_NAME_CONSTANT;
?>
I have a value
I have a valueI have a value
ERROR
I have a valueNEW_GOO_NAME_CONSTANTS
Complete text representation of month
Day of month, with leading zero
Daylight saving time
Day of month, without zeros
<?php $i = 5;
while (--$i > 0 || ++$i){ print $i;
} ?>
54321111111….infinitely
555555555…infinitely
54321
5
<?php $i = 5;
while (--$i > 0){ $i++;
print $i;
print hello;
} ?>
4hello4hello4hello4hello4hello…..infinite
5hello5hello5hello5hello5hello…..infinite
no output
error
<?php $i = 5;
while (--$i > 0 && ++$i){ print $i;
} ?>
5
555555555…infinitely
54321
error
<?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 $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 define('GOOD_OCTAL', 0700);
define('BAD_OCTAL', 0600);
print GOOD_OCTAL;
print '
';
print BAD_OCTAL;
?>
384
0800
ERROR
No output
$date = Date(22 JUNE 2013)
$date = new Date(JUNE 22 2013)
$date = DateTime(22 JUNE 2013)
$date = new DateTime(22 JUNE 2013)
<?php define(GREETING, PHP is a scripting language);
echo $GREETING;
?>
$GREETING
no output
PHP is a scripting language
GREETING
<?php define(VAR_NAME,test);
${VAR_NAME} = value;
echo VAR_NAME;
echo ${VAR_NAME};
?>
test
testtest
testvalue
error, constant value cannot be changed
<?php class myObject { }define('myObject::CONSTANT', 'test');
echo myObject::CONSTANT;
?>
test
error
myObject::CONSTANT
no output
<?php $color1 = red;
$color2 = red;
echo $color1 + $color2;
?>
redgreen
red green
0
1
<?php define(__LINE__, PHP is a scripting language);
echo __LINE__;
?>
PHP is a scripting language
__LINE__
2
ERROR
<?php echo (checkdate(4,31,2010) ? 'Valid' : 'Invalid');
?>
TRUE
FALSE
Valid
Invalid
<?php $i = 2;
while (++$i){ while (--$i > 0) print $i;
} ?>
210
10
no output
infinite loop
A PHP script should start with ___ and end with ___:
< php >
< ? php ?>
<?php ?>
<% %>
<?php $i = 0;
while (++$i && --$i){ print $i;
} ?>
1234567891011121314….infinitely
01234567891011121314…infinitely
no output
error
<?php define(GREETING, PHP is a scripting language, true);
echo GREETING;
echo
echo GREETING;
?>
PHP is a scripting language
GREEtING
GREETING
PHP is a scripting language
start_session()
session_start()
session_begin()
begin_session()
<?php $color = red;
echo $color . red ;
?>
red red
red
error
nothing
<?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 )
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 $color1 = 1;
$color2 = 1;
echo $color1 + $color2;
?>
11
2
0
1
T
N
E
I
Delete the previous session
Start a new session
Check whether a valid session exists
Handle the session
<?php printf( date(t) ) ?>
30
22
JUNE
2013
<?php $color1 = red;
$color2 = green;
echo $color1 . $color2;
?>
red
green
red green
redgreen