adding string with number in php

Solutions on MaxInterview for adding string with number in php by the best coders in the world

showing results for - "adding string with number in php"
Stefano
24 Aug 2018
1$a = "3dollars";
2$b = 20;
3echo $a += $b;
4print($a += $b);
5------------------------------
6It casts '3dollars' as a number, getting $a = 3.
7
8When you echo, you add 20, to $a, so it prints 23 and $a = 23.
9
10Then, when you print, you again add 20, so now $a = 43.
11