3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class MyType { const UNKNOWN = 0; const VALUE_ONE = 1; const VALUE_TWO = 2; const VALUE_THREE = 3; const VALUE_FOUR = 4; const VALUE_FIVE = 5; static public $__names = array( 0 => 'UNKNOWN', 1 => 'VALUE_ONE', 2 => 'VALUE_TWO', 3 => 'VALUE_THREE', 4 => 'VALUE_FOUR', 5 => 'VALUE_FIVE', ); } $test = new MyType(); echo $test->__names[count($test->__names) - 1]; //echo constant('MyType::' . $test->__names[count($test->__names) - 1]); ?>
Output for git.master, git.master_jit, rfc.property-hooks
Notice: Accessing static property MyType::$__names as non static in /in/jbCHt on line 22 Warning: Undefined property: MyType::$__names in /in/jbCHt on line 22 Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /in/jbCHt:22 Stack trace: #0 {main} thrown in /in/jbCHt on line 22
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:
43.65 ms | 401 KiB | 8 Q