3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $foo = new class { private $a = 3; protected $b = 2; public $c = 1; }; $arr = (array)$foo; var_dump($arr); var_dump(array_keys($arr)[0][0]); $b = array_keys($arr)[0]; var_dump($b);
based on sks4C
Output for 7.3.1
array(3) { ["class@anonymous/in/ov2YC0x7f16ab35f04ba"]=> int(3) ["*b"]=> int(2) ["c"]=> int(1) } string(1) "" string(42) "class@anonymous/in/ov2YC0x7f16ab35f04ba"
Output for 7.3.0
array(3) { ["class@anonymous/in/ov2YC0x7fc530a3704ba"]=> int(3) ["*b"]=> int(2) ["c"]=> int(1) } string(1) "" string(42) "class@anonymous/in/ov2YC0x7fc530a3704ba"
Output for 7.2.13
array(3) { ["class@anonymous/in/ov2YC0x7fc2c232f04ba"]=> int(3) ["*b"]=> int(2) ["c"]=> int(1) } string(1) "" string(42) "class@anonymous/in/ov2YC0x7fc2c232f04ba"
Output for 7.2.12
array(3) { ["class@anonymous/in/ov2YC0x7f41ab03204ba"]=> int(3) ["*b"]=> int(2) ["c"]=> int(1) } string(1) "" string(42) "class@anonymous/in/ov2YC0x7f41ab03204ba"
Output for 7.2.11
array(3) { ["class@anonymous/in/ov2YC0x7ff6cac1004ba"]=> int(3) ["*b"]=> int(2) ["c"]=> int(1) } string(1) "" string(42) "class@anonymous/in/ov2YC0x7ff6cac1004ba"
Output for 7.2.10
array(3) { ["class@anonymous/in/ov2YC0x7f107b76304ba"]=> int(3) ["*b"]=> int(2) ["c"]=> int(1) } string(1) "" string(42) "class@anonymous/in/ov2YC0x7f107b76304ba"
Output for 7.2.9
array(3) { ["class@anonymous/in/ov2YC0x7fa5db16504ba"]=> int(3) ["*b"]=> int(2) ["c"]=> int(1) } string(1) "" string(42) "class@anonymous/in/ov2YC0x7fa5db16504ba"
Output for 7.2.8
array(3) { ["class@anonymous/in/ov2YC0x7f617f66e04ba"]=> int(3) ["*b"]=> int(2) ["c"]=> int(1) } string(1) "" string(42) "class@anonymous/in/ov2YC0x7f617f66e04ba"
Output for 7.2.7
array(3) { ["class@anonymous/in/ov2YC0x7fccb344304ba"]=> int(3) ["*b"]=> int(2) ["c"]=> int(1) } string(1) "" string(42) "class@anonymous/in/ov2YC0x7fccb344304ba"
Output for 7.2.6
array(3) { ["class@anonymous/in/ov2YC0x7f582103804ba"]=> int(3) ["*b"]=> int(2) ["c"]=> int(1) } string(1) "" string(42) "class@anonymous/in/ov2YC0x7f582103804ba"
Output for 7.2.5
array(3) { ["class@anonymous/in/ov2YC0x7f512d1c304ba"]=> int(3) ["*b"]=> int(2) ["c"]=> int(1) } string(1) "" string(42) "class@anonymous/in/ov2YC0x7f512d1c304ba"
Output for 7.2.4
array(3) { ["class@anonymous/in/ov2YC0x7ff74bcb104ba"]=> int(3) ["*b"]=> int(2) ["c"]=> int(1) } string(1) "" string(42) "class@anonymous/in/ov2YC0x7ff74bcb104ba"
Output for 7.2.3
array(3) { ["class@anonymous/in/ov2YC0x7fda6b79204ba"]=> int(3) ["*b"]=> int(2) ["c"]=> int(1) } string(1) "" string(42) "class@anonymous/in/ov2YC0x7fda6b79204ba"
Output for 7.2.2
array(3) { ["class@anonymous/in/ov2YC0x7f701ce8304ba"]=> int(3) ["*b"]=> int(2) ["c"]=> int(1) } string(1) "" string(42) "class@anonymous/in/ov2YC0x7f701ce8304ba"
Output for 7.2.1
array(3) { ["class@anonymous/in/ov2YC0x7f59bc13704ba"]=> int(3) ["*b"]=> int(2) ["c"]=> int(1) } string(1) "" string(42) "class@anonymous/in/ov2YC0x7f59bc13704ba"
Output for 7.2.0
array(3) { ["class@anonymous/in/ov2YC0x7f02517e304ba"]=> int(3) ["*b"]=> int(2) ["c"]=> int(1) } string(1) "" string(42) "class@anonymous/in/ov2YC0x7f02517e304ba"
Output for 7.1.25
array(3) { ["class@anonymous/in/ov2YC0x7fb99ba3e04ba"]=> int(3) ["*b"]=> int(2) ["c"]=> int(1) } string(1) "" string(42) "class@anonymous/in/ov2YC0x7fb99ba3e04ba"
Output for 7.1.20
array(3) { ["class@anonymous/in/ov2YC0x7f9c4118904ba"]=> int(3) ["*b"]=> int(2) ["c"]=> int(1) } string(1) "" string(42) "class@anonymous/in/ov2YC0x7f9c4118904ba"
Output for 7.1.10
array(3) { ["class@anonymous/in/ov2YC0x7f5a6718f04ba"]=> int(3) ["*b"]=> int(2) ["c"]=> int(1) } string(1) "" string(42) "class@anonymous/in/ov2YC0x7f5a6718f04ba"
Output for 7.1.7
array(3) { ["class@anonymous/in/ov2YC0x7f664235904ba"]=> int(3) ["*b"]=> int(2) ["c"]=> int(1) } string(1) "" string(42) "class@anonymous/in/ov2YC0x7f664235904ba"
Output for 7.1.6
array(3) { ["class@anonymous/in/ov2YC0x7f024986004ba"]=> int(3) ["*b"]=> int(2) ["c"]=> int(1) } string(1) "" string(42) "class@anonymous/in/ov2YC0x7f024986004ba"
Output for 7.1.5
array(3) { ["class@anonymous/in/ov2YC0x7f3b3c42504ba"]=> int(3) ["*b"]=> int(2) ["c"]=> int(1) } string(1) "" string(42) "class@anonymous/in/ov2YC0x7f3b3c42504ba"
Output for 7.1.0
array(3) { ["class@anonymous/in/ov2YC0x7f485540d04ba"]=> int(3) ["*b"]=> int(2) ["c"]=> int(1) } string(1) "" string(42) "class@anonymous/in/ov2YC0x7f485540d04ba"
Output for 7.0.20
array(3) { ["class@anonymous/in/ov2YC0x7f142407804ba"]=> int(3) ["*b"]=> int(2) ["c"]=> int(1) } string(1) "" string(42) "class@anonymous/in/ov2YC0x7f142407804ba"
Output for 7.0.6
array(3) { ["class@anonymous/in/ov2YC0x7f9da8f8604ba"]=> int(3) ["*b"]=> int(2) ["c"]=> int(1) } string(1) "" string(42) "class@anonymous/in/ov2YC0x7f9da8f8604ba"
Output for 7.0.5
array(3) { ["class@anonymous/in/ov2YC0x7fdec870104ba"]=> int(3) ["*b"]=> int(2) ["c"]=> int(1) } string(1) "" string(42) "class@anonymous/in/ov2YC0x7fdec870104ba"
Output for 7.0.4
array(3) { ["class@anonymous/in/ov2YC0x7f35db32504ba"]=> int(3) ["*b"]=> int(2) ["c"]=> int(1) } string(1) "" string(42) "class@anonymous/in/ov2YC0x7f35db32504ba"
Output for 7.0.3
array(3) { ["class@anonymous/in/ov2YC0x7fb6c62d404ba"]=> int(3) ["*b"]=> int(2) ["c"]=> int(1) } string(1) "" string(42) "class@anonymous/in/ov2YC0x7fb6c62d404ba"
Output for 7.0.2
array(3) { ["class@anonymous/in/ov2YC0x7f6ae105404ba"]=> int(3) ["*b"]=> int(2) ["c"]=> int(1) } string(1) "" string(42) "class@anonymous/in/ov2YC0x7f6ae105404ba"
Output for 7.0.1
array(3) { ["class@anonymous/in/ov2YC0x7f5fb4a5a04ba"]=> int(3) ["*b"]=> int(2) ["c"]=> int(1) } string(1) "" string(42) "class@anonymous/in/ov2YC0x7f5fb4a5a04ba"
Output for 7.0.0
array(3) { ["class@anonymous/in/ov2YC0x7f129e0e004ba"]=> int(3) ["*b"]=> int(2) ["c"]=> int(1) } string(1) "" string(42) "class@anonymous/in/ov2YC0x7f129e0e004ba"
Output for 5.4.11 - 5.6.28
Parse error: syntax error, unexpected 'class' (T_CLASS) in /in/ov2YC on line 3
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected T_CLASS in /in/ov2YC on line 3
Process exited with code 255.