run code in 200+ php & hhvm versions
Bugs & Features
<?php function modulo($number, $modulus) { return bcsub($number, bcmul(bcdiv($number, $modulus, 0), $modulus)); } bcscale(1); var_dump(modulo("3.5", "4")); // 3.5 var_dump(modulo("1071", "357.5")); // 356
based on tGuNm

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
Fatal error: Uncaught Error: Call to undefined function bcscale() in /in/nLMC4:7 Stack trace: #0 {main} thrown in /in/nLMC4 on line 7
Output for Arrow functions
string(3) "3.5" string(5) "356.0"
Output for Object typehint
string(3) "3.5" string(5) "356.0"
Output for Array change keys
string(3) "3.5" string(5) "356.0"
Output for Lexical anon
string(3) "3.5" string(5) "356.0"

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