3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo 'sdafsd'; namespace Kata\Encoders; class Encoder { protected $numerals = [ 'M' => 1000, 'CM' => 900, 'D' => 500, 'CD' => 400, 'C' => 100, 'XC' => 90, 'L' => 50, 'XL' => 40, 'X' => 10, 'IX' => 9, 'V' => 5, 'IV' => 4, 'I' => 1, ]; /** * Convert a given decimal value to roman * * @param integer $decimal * @return string */ function romanify( $decimal ) { $numeral = ''; $number = $decimal; foreach ($this->numerals as $sign => $value) { while( $number >= $value ) { $numeral .= $sign; $number -= $value; } } return $numeral; } //echo (romanify(12.2)); echo 'sadfsad'; } ?>
Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.29
Fatal error: Namespace declaration statement has to be the very first statement in the script in /in/mLa34 on line 3
Process exited with code 255.

preferences:
190.3 ms | 1399 KiB | 66 Q