Answers for "Adding string with number in php"

PHP
0

Adding string with number in php

$a = "3dollars";
$b = 20;
echo $a += $b;
print($a += $b);
------------------------------
It casts '3dollars' as a number, getting $a = 3.

When you echo, you add 20, to $a, so it prints 23 and $a = 23.

Then, when you print, you again add 20, so now $a = 43.
Posted by: Guest on November-17-2020

Code answers related to "Adding string with number in php"

Browse Popular Code Answers by Language