<?php define(VAR_NAME,test);
${VAR_NAME} = value;
echo VAR_NAME;
echo ${VAR_NAME};
?>
<?php printf( date(t) ) ?>
<?php define(GREETING, PHP is a scripting language);
echo $GREETING;
?>
session.domain
session.path
session.cookie_path
session.cookie_domain
<?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();
?>
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)
Which of the following PHP statements will output Hello World on the screen?
i) echo (“Hello World”);
ii) print (“Hello World”);
iii) printf (“Hello World”);
iv) sprintf (“Hello World”);
i) and ii)
i), ii) and iii)
All of the mentioned
i), ii) and iv)
<?php $color1 = red;
$color2 = green;
echo $color1 + $color2;
?>
<?php /*echo Hello world;
*/ ?>
/* Hello world */
<?php $color1 = red;
$color2 = green;
echo $color1 . $color2;
?>
<?php $color1 = red;
$color2 = 1;
echo $color1 + $color2;
?>
<?php $i = 5;
while (--$i > 0 || ++$i){ print $i;
} ?>
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 $i = 0;
while(++$i || --$i){ print $i;
} ?>
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
time()
mktime()
mrtime()
mtime()
<?php define('IF', 42);
echo IF: , IF;
?>
lastmod()
getlastmod()
last_mod()
get_last_mod()
<?php $i = 0;
while (++$i && --$i){ print $i;
} ?>
<?php echo Today is .date(F d, Y) ?>
A PHP script should start with ___ and end with ___:
< php >
< ? php ?>
<?php ?>
<% %>
<?php $color = red;
$color = green;
echo $color;
?>
<?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 $color = red;
echo $color . red ;
?>
<?php echo (checkdate(4,31,2010) ? 'Valid' : 'Invalid');
?>
<?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 )
start_session()
session_start()
session_begin()
begin_session()
<?php $cars = array(Volvo, BMW, Toyota, Honda, Mercedes, Opel);
print_r(array_chunk($cars, 2));
?>
Array ( [0] => Array ( [1] => Volvo [2] => BMW ) [1] => Array ( [1] => Toyota [2] => Honda ) [2] => Array ( [1] => Mercedes [2] => Opel ) )
Array ( [1] => Array ( [1] => Volvo [2] => BMW ) [2] => Array ( [1] => Toyota [2] => Honda ) [3] => Array ( [1] => Mercedes [2] => Opel ) )
Array ( [0] => Array ( [0] => Volvo [1] => Volvo ) [1] => Array ( [0] => BMW [1] => BMW ) [2] => Array ( [0] => Toyota [1] => Toyota ) )
Array ( [0] => Array ( [0] => Volvo [1] => BMW ) [1] => Array ( [0] => Toyota [1] => Honda ) [2] => Array ( [0] => Mercedes [1] => Opel ) )
<?php $i = 5;
while (--$i > 0){ $i++;
print $i;
print hello;
} ?>
<?php $i = 0;
while ($i = 10){ print hi;
}print hello;
?>
<?php $i = 5;
while (--$i > 0 && ++$i){ print $i;
} ?>
<?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 )
save_data
session.save
session.save_data
session.save_handler
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 $i = ;
while ($i = 10){ print hi;
}print hello;
?>
<?php define('GOOD_OCTAL', 0700);
define('BAD_OCTAL', 0600);
print GOOD_OCTAL;
print '
';
print BAD_OCTAL;
?>
<?php define('GREETING_TEST', 'PHP is a scripting language', true);
echo GREETING_TESt;
$changing_variable = 'test';
echo constant('GREETING_' . strtoupper($changing_variable));
?>
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 = 2;
while (++$i){ while (--$i > 0) print $i;
} ?>
totime(+45)
totime(+45 days)
strtotime(+45 days)
strtotime(-45 days)
<?php $i = 0;
while ((--$i > ++$i) - 1){ print $i;
} ?>
<?php $color1 = 1;
$color2 = 1;
echo $color1 + $color2;
?>
<?php $color1 = red;
$color2 = red;
echo $color1 + $color2;
?>