1 + 2 is 3 (integer) 1 . 2 is 12 (string) int + an int = another int because they are all the same datatype.
1 + 2 is 3 (double) 1 . 2 is 12 (string) int + double = double because of type promotion and turns the int
into a double.
Warning: A non-numeric value encountered in /home/stu/jwong/public_html/lab2.php on line 79
Warning: A non-numeric value encountered in /home/stu/jwong/public_html/lab2.php on line 79
1.0 word + 2 is 3 (double) 1.0 word . 2 is 1.0 word2 (string) string + double = double because strings with numbers are evaluated and turned into either an int or a double.
Fatal error: Uncaught TypeError: Unsupported operand types: string + float in /home/stu/jwong/public_html/lab2.php:91
Stack trace:
#0 {main}
thrown in /home/stu/jwong/public_html/lab2.php on line 91