3v4l.org

run code in 300+ PHP versions simultaneously
<?php function check(float $value){ $value < 0.001 or $value > 1000.0 and throw new \InvalidArgumentException( 'FairnessWeight must be in the range [0.001, 1000].', ); } $values = [0.0, 1000.0, -1.0, 1010.0]; foreach($values as $v) { echo "Checking value: {$v}:\t"; try { check($v); echo "all good. \n"; } catch (\Throwable $e) { echo "failed! {$e->getMessage()}\n"; } }

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
169.56 ms | 1336 KiB | 11 Q