こういう型システムを無視したワンダーな挙動だったのを思い出した
- PHP 7.3.11
<?php echo '1' + 1 . "\n"; echo '1' + '1' . "\n"; echo '1' + 1.5 . "\n"; echo '1' + '1.5' . "\n";
https://www.php.net/manual/ja/language.types.string.php#language.types.string.conversion
こういう型システムを無視したワンダーな挙動だったのを思い出した
<?php echo '1' + 1 . "\n"; echo '1' + '1' . "\n"; echo '1' + 1.5 . "\n"; echo '1' + '1.5' . "\n";
https://www.php.net/manual/ja/language.types.string.php#language.types.string.conversion