3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $pi = 4; $top = 4; $bot = 3; $minus = TRUE; $accuracy = 1000000; for($i = 0; $i < $accuracy; $i++) { $pi += ( $minus ? -($top/$bot) : ($top/$bot) ); $minus = ( $minus ? FALSE : TRUE); $bot += 2; } print "Pi ~=: " . $pi;
Output for 4.3.0 - 7.1.0
Pi ~=: 3.1415936535888