Answers for "php add integer to string"

PHP
14

integer to string php

return strval($integer);
Posted by: Guest on April-06-2020
0

add two numbers as string in php

$num = "3.14";
$int = (int)$num;
$float = (float)$num;
Posted by: Guest on June-22-2020
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

Browse Popular Code Answers by Language