What will be the output of the following PHP code ?
<?php
$a = 10;
echo ++$a;
echo $a++;
echo $a;
echo ++$a;
?>
<?php
$a = 10;
echo ++$a;
echo $a++;
echo $a;
echo ++$a;
?>
A. 11111213
B. 11121213
C. 11111212
D. 11111112
Answer: Option A
Solution(By Examveda Team)
++$a increments a and then prints it,$a++ prints and then increments.Related Questions on Operators and Expressions in php
What will be the output of the following PHP code ?
<?php
"Hello World"
?>
A. Error
B. Hello World
C. Nothing
D. Missing semicolon error
What will be the output of the following PHP code ?
<?php
print_r "Hello world"
?>
A. Error
B. Hello World
C. Nothing
D. Missing semicolon error
A. redredred
B. redred
C. red
D. Error
A. # Hello world
B. Hello world# Hello world
C. Hello world
D. Error
Join The Discussion