Examveda
Examveda

What will be the output of the following PHP code ?
<?php
$cars = array("Volvo", "BMW", "Toyota");
echo "My car is a {$cars[0]}";
?>

A. My car is a Volvo

B. My car is a BMW

C. My car is a Toyota

D. Error

Answer: Option A

Solution(By Examveda Team)

In the echo statement the {$cars[0]} is replaced by the 1st element in cars that is Volvo.

This Question Belongs to PHP >> Operators And Expressions In Php

Join The Discussion

Related Questions on Operators and Expressions in php