Why get error ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why get error ?

<?php $str = "10" $int = 20; $sum = "$str + $int"> echo ($sum); ?>

26th Mar 2017, 8:46 AM
Ram Anuj Verma
Ram Anuj Verma - avatar
3 Answers
+ 3
Make following changes <?php $str = "10"; //Missed semi-colon $int = 20; $sum = "$str + $int"; //1. another typo > instead of ; //2. will result into 10 + 20. Remove quotes to get actual sum echo ($sum); ?>
26th Mar 2017, 8:53 AM
เคฆเฅ‡เคตเฅ‡เค‚เคฆเฅเคฐ เคฎเคนเคพเคœเคจ (Devender)
เคฆเฅ‡เคตเฅ‡เค‚เคฆเฅเคฐ เคฎเคนเคพเคœเคจ (Devender) - avatar
+ 2
<?php $str = "10"; $int = 20; $sum = "$str + $int"; echo ($sum); ?>
26th Mar 2017, 8:52 AM
Yaroslav Pieskov
Yaroslav Pieskov - avatar
+ 1
thanks I got it .
26th Mar 2017, 8:53 AM
Ram Anuj Verma
Ram Anuj Verma - avatar