3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $num = 23; $base = 2; $stack = new SplStack(); while( $num > 0) { $stack->push($num % $base); $num = (int) $num/$base; // no integer division var_dump($num); } $stack->rewind(); while( $stack->valid() ) { echo $stack->current(); $stack->next(); } echo "\n";
Output for 5.3.0 - 7.1.0
float(11.5) float(5.5) float(2.5) int(1) float(0.5) int(0) 010111
Output for 5.0.0 - 5.2.17
Fatal error: Class 'SplStack' not found in /in/Wku56 on line 4
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: splstack in /in/Wku56 on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: splstack in /in/Wku56 on line 4