3v4l.org

run code in 300+ PHP versions simultaneously
<?php $yearwithdecimal = "1.2"; $months = 0; if($yearwithdecimal){ $parts = explode('.', $yearwithdecimal); $months = $parts[0]*12 + $parts[1] ?? 0; } echo $months;

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
187.92 ms | 1715 KiB | 9 Q