Home

What is the correct answer?

4

What will be the output of the following PHP code?
 <?php  $cars = array(Volvo, BMW, Toyota);
echo I like . $cars[0] . , . $cars[1] . and . $cars[2] . .;
?>

A. I like Volvo BMW and Toyota.

B. I like Volvo, BMW and Toyota)

C. I like Volvo, BMW and Toyota.

D. I like. Volvo.,. BMW. and. Toyota)

Correct Answer :

B. I like Volvo, BMW and Toyota)


The array() function is used to create an array. Each elements are assigned ab index as the rule of an array. So, calling $cars[0] will print element at index 0 and so on.

Related Questions

Which one of the following format parameter can be used to identify timezone? What will be the output of the following PHP code? <?php $cars = array(Volvo,… If the format is F then which one of the following will be returned? What will be the output of the following code?<?php $foo = 'Bob';… Neglecting to set which of the following cookie will result in the cookies… Which function displays the web pages most recent modification date? What will be the output of the following PHP code ? <?php $color1 =… What will be the output of the following PHP code ? <?php define(GREETING,… What will be the output of the following PHP code ? <?php define(GREETING,… What will be the output of the following PHP code ? <?php $i = ;while… The date() function returns ___ representation of the current date and/or… What will be the output of the following PHP code ? <?php $color =… PHP files have a default file extension of.. Which one of the following function is used to start a session? Which of the following PHP statements will output Hello World on the screen?i)… What will be the output of the following PHP code? <?php $a1 = array(red,… What is the default time(in seconds) for which session data is considered… What will be the output of the following PHP code ? <?php $i = 0;while… What will be the output of the following PHP code ? <?php define('GREETING_TEST',… Which of the following is/are a PHP code editor?i) Notepadii) Notepad++iii)… What will be the output of the following PHP code ? <?php $color =… What will be the output of the following PHP code ? <?php $i = 2;while… What will be the output of the following PHP code ? <?php $i = 0;while… What will be the output of the following PHP code? <?php $a1 = array_fill(3,… A PHP script should start with ___ and end with ___: What will be the output of the following PHP code? <?php echo (checkdate(4,31,2010)… What will be the output of the following PHP code? If say date is 22/06/2013.… What will be the output of the following PHP code ? <?php $i = 5;while… What will be the output of the following PHP code ? <?php $color1 =… What will be the output of the following PHP code ? <?php class Constants{…