3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types = 1); enum Foo: int { case A = 1; case B = 2; } var_dump(Foo::A > Foo::B); // I expect an error here as it is always false (enum cases are not comparable and always return false) var_dump(Foo::A < Foo::B); // I expect an error here as it is always false (enum cases are not comparable and always return false) var_dump(Foo::A === Foo::B); // OK var_dump(Foo::A == Foo::B); // I expect an error here as it is always false (enum cases are not comparable and always return false) var_dump(Foo::A === Foo::A); // I expect an error here as it is always true var_dump(Foo::A->value > Foo::B->value); // OK var_dump(Foo::A->value < Foo::B->value); // OK var_dump(Foo::A->value === Foo::B->value); // OK var_dump(Foo::A->value == Foo::B->value); // I'd probably expect an error here as well as always false var_dump(Foo::A->value === Foo::A->value); // I'd probably expect an error here as well as this is always true
Output for 8.1.5 - 8.1.34, 8.2.20 - 8.2.30, 8.3.5 - 8.3.30, 8.4.1 - 8.4.14, 8.4.16 - 8.4.18, 8.5.0 - 8.5.3
bool(false) bool(false) bool(false) bool(false) bool(true) bool(false) bool(true) bool(false) bool(false) bool(true)
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.

preferences:
82.01 ms | 479 KiB | 5 Q