3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface ContainerInterface1 { public function get($id); } interface ContainerInterface2 { public function get($id, $params = [], $setters = [], $shared = true); } class Container implements ContainerInterface1, ContainerInterface2 { public function get($id, $params = [], $setters = [], $shared = true) { return $id; } } class Y { public function setContainer(ContainerInterface1 $value) { $this->value = $value; } } $container = new Container(); var_dump($container instanceof ContainerInterface1); var_dump($container instanceof ContainerInterface2); echo $container->get('hello'); $y = new Y(); $y->setContainer($container);
Output for 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.14, 8.4.16 - 8.4.18, 8.5.0 - 8.5.3
bool(true) bool(true) hello Deprecated: Creation of dynamic property Y::$value is deprecated in /in/bB0Oj on line 25
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.
Output for 5.6.0 - 5.6.27, 7.0.0 - 7.0.20, 7.1.0 - 7.1.7, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.34
bool(true) bool(true) hello

preferences:
187.2 ms | 410 KiB | 5 Q