Day 3:資料型態的夢魘——動態型別加弱型別(2)
Last updated
Was this helpful?
Was this helpful?
$x = 123 + "456";
echo $x;579$n1 = 123;
$n2 = 456;
$s1 = "Hello";
$x = $n1 + $s1;
echo $x;123
PHP Warning: A non-numeric value encountered in /home/cg/root/6938116/main.php on line 4echo ("111" == 111) ? "Yes" : "No"; // "Yes"
echo ("111" === 111) ? "Yes" : "No"; // "No"$x = 123 + array("Apple", "Banana");
echo $x;PHP Fatal error: Unsupported operand types in /home/cg/root/6938116/main.php on line 3x = 123 + "Hello Python"
print x + "\n"TypeError: unsupported operand type(s) for +: 'int' and 'str'double x = 123;
System.out.println(x); // 123.0int value = 12345;
int* ptr = &value;
*ptr = 999999999999999999999999999; // overflow
printf("%d\n", *ptr);