3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php phpversion >= "7.0.0" or die(); $a = 5; $n = 2; echo $a % $n,"\n"; //echo mod($a,$n),"\n"; PHP doesn't have mod() but does have fmod(); see http://php.net/fmod echo fmod((float)$a,(float)$n),"\n"; echo $a - ($n * (int)($a/$n)),"\n"; $a = INF; $n = pow(2.,64.); try{ echo $a % $n,"\n"; } catch (Error $e){ echo $e->getMessage(),"\n"; } echo fmod((float)$a,(float)$n),"\n"; echo $a - ($n * (int)($a/$n)),"\n";
based on T8DWQ

Shows result from various feature-branches currently under review from the php developers. Contact me to have additional branches featured.

Output for Typed properties v2
Warning: Use of undefined constant phpversion - assumed 'phpversion' (this will throw an Error in a future version of PHP) in /in/7sErV on line 2 1 1 1 Modulo by zero NAN INF
Output for Arrow functions
Notice: Use of undefined constant phpversion - assumed 'phpversion' in /in/7sErV on line 2 1 1 1 Modulo by zero NAN INF
Output for Object typehint
Notice: Use of undefined constant phpversion - assumed 'phpversion' in /in/7sErV on line 2 1 1 1 Modulo by zero NAN INF
Output for Array change keys
Notice: Use of undefined constant phpversion - assumed 'phpversion' in /in/7sErV on line 2 1 1 1 Modulo by zero NAN INF
Output for Lexical anon
Notice: Use of undefined constant phpversion - assumed 'phpversion' in /in/7sErV on line 2 1 1 1 Warning: Division by zero in /in/7sErV on line 15 NAN INF

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