<?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 )
time()
mktime()
mrtime()
mtime()
<?php class myObject { }define('myObject::CONSTANT', 'test');
echo myObject::CONSTANT;
?>
<?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 echo Today is .date(F d, Y) ?>
<?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 $i = 0;
while ((--$i > ++$i) - 1){ print $i;
} ?>
start_session()
session_start()
session_begin()
begin_session()
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
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 $i = 2;
while (++$i){ while (--$i > 0) print $i;
} ?>
<?php define(VAR_NAME,test);
${VAR_NAME} = value;
echo VAR_NAME;
echo ${VAR_NAME};
?>
<?php define(GREETING, PHP is a scripting language, true);
echo GREETING;
echo
echo GREETING;
?>
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 define(__LINE__, PHP is a scripting language);
echo __LINE__;
?>
lastmod()
getlastmod()
last_mod()
get_last_mod()
<?php $color1 = red;
$color2 = green;
echo $color1 + $color2;
?>
PHP files have a default file extension of..
.html
.xml
.php
.ph
<?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 ) )
$date = Date(22 JUNE 2013)
$date = new Date(JUNE 22 2013)
$date = DateTime(22 JUNE 2013)
$date = new DateTime(22 JUNE 2013)
save_data
session.save
session.save_data
session.save_handler
<?php define('GREETING_TEST', 'PHP is a scripting language', true);
echo GREETING_TESt;
$changing_variable = 'test';
echo constant('GREETING_' . strtoupper($changing_variable));
?>
<?php $i = 0;
while(++$i || --$i){ print $i;
} ?>
<?php $i = 2;
while (++$i){ while ($i --> 0) print $i;
} ?>
<?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;
?>
<?php define(GREETING, PHP is a scripting language);
echo $GREETING;
?>
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 define('IF', 42);
echo IF: , IF;
?>
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 = 5;
while (--$i > 0){ $i++;
print $i;
print hello;
} ?>
<?php $i = 0;
while (++$i && --$i){ print $i;
} ?>
<?php printf( date(t) ) ?>
<?php $cars = array(Volvo, BMW, Toyota);
echo I like . $cars[0] . , . $cars[1] . and . $cars[2] . .;
?>
<?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 $color = red;
echo $color . red ;
?>
<?php /*echo Hello world;
*/ ?>
/* Hello world */
<?php $color1 = 1;
$color2 = 1;
echo $color1 + $color2;
?>
<?php $color1 = red;
$color2 = green;
echo $color1 . $color2;
?>
totime(+45)
totime(+45 days)
strtotime(+45 days)
strtotime(-45 days)
<?php $color1 = red;
$color2 = 1;
echo $color1 + $color2;
?>
A PHP script should start with ___ and end with ___:
< php >
< ? php ?>
<?php ?>
<% %>
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 = red;
echo $color1 + $color2;
?>
<?php $i = 5;
while (--$i > 0 && ++$i){ print $i;
} ?>