3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Assert { /** * @param int $value * * @return self */ public static function unsignedInt(int $value) : string { if (0 > $value) { throw new InvalidArgumentException('Значение должно быть не отрицательным.'); } return __CLASS__; } /** * @param int $value * * @return self */ public static function notZeroInt(int $value) : string { if (0 === $value) { throw new InvalidArgumentException('Значение должно быть не равным нолю.'); } return __CLASS__; } /** * @param float $value * * @return self */ public static function unsignedFloat(float $value) : string { if (0 > $value) { throw new InvalidArgumentException('Значение должно быть не отрицательным.'); } return __CLASS__; } /** * @param float $value * * @return self */ public static function notZeroFloat(float $value) : string { if (0 === $value) { throw new InvalidArgumentException('Значение должно быть не равным нолю.'); } return __CLASS__; } /** * @param string $value * * @return self */ public static function notEmptyString(string $value) : string { if ('' === $value) { throw new InvalidArgumentException('Значение должно быть не пустой строкой'); } return __CLASS__; } } Assert::notZeroInt(3)::unsignedInt(3); Assert::notZeroInt(0)::unsignedInt(0);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught InvalidArgumentException: Значение должно быть не равным нолю. in /in/AsP8p:27 Stack trace: #0 /in/AsP8p(77): Assert::notZeroInt(0) #1 {main} thrown in /in/AsP8p on line 27
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
275.44 ms | 405 KiB | 5 Q