Welcome to Abdulelah's Lab 2
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
2 |
4 |
6 |
8 |
10 |
12 |
14 |
16 |
18 |
20 |
3 |
6 |
9 |
12 |
15 |
18 |
21 |
24 |
27 |
30 |
4 |
8 |
12 |
16 |
20 |
24 |
28 |
32 |
36 |
40 |
5 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
6 |
12 |
18 |
24 |
30 |
36 |
42 |
48 |
54 |
60 |
7 |
14 |
21 |
28 |
35 |
42 |
49 |
56 |
63 |
70 |
8 |
16 |
24 |
32 |
40 |
48 |
56 |
64 |
72 |
80 |
9 |
18 |
27 |
36 |
45 |
54 |
63 |
72 |
81 |
90 |
10 |
20 |
30 |
40 |
50 |
60 |
70 |
80 |
90 |
100 |
1 + 2 is 3 (integer)
Since we are adding int to int, the result will be an int since the grammar of the addition function specify so.
1 . 2 is 12 (string)
In this, we have used a dot (.) which is the way to concatenate two strings together so the result shall be a string.
1 + 2 is 3 (double)
Whenever a double/float is added to an integer or vise versa, php cast the result as a double or float to meet the best result.
1 . 2 is 12 (string)
As mentioned earlier, the dot is always used to concatenate two strings.
Warning: A non-numeric value encountered in /home/stu/aaldeshash/public_html/3680/wk2/lab2.php on line 103
Warning: A non-numeric value encountered in /home/stu/aaldeshash/public_html/3680/wk2/lab2.php on line 103
1.0 word + 2 is 3 (double)
Since the + is an arithmatic operation, php do its best to meet the expectation of the coder. However, its best to stay away of this type of operations.
1.0 word . 2 is 1.0 word2 (string)
As mentioned earlier, the dot is always used to concatenate two strings.
Fatal error: Uncaught TypeError: Unsupported operand types: string + float in /home/stu/aaldeshash/public_html/3680/wk2/lab2.php:121
Stack trace:
#0 {main}
thrown in /home/stu/aaldeshash/public_html/3680/wk2/lab2.php on line 121