+ 1
Why the output is 0?
<?php $name="Aizaz Ahmed"; $title="teacher"; echo $name + " is a " + $title; ?>
5 Answers
+ 8
Strings become 0 while conversion to integer in PHP.
echo "one" + 2; => outputs 0 + 2 = 2
+ 6
Concatenation varies from language to language.
+ 3
so use . instead of +
+ 1
means @Krishna Teja Yeluripati
whenever we use '+' operator in strings it will give 0
whereas in python it will add two strings
Thanks for your answer :)
0
<?php
$name = "Aizaz Ahmed";
$title = "teacher";
echo $name. " is a ". $title;
?>