3v4l.org

run code in 300+ PHP versions simultaneously
<?php $digits = array(9,8,7,6,5,4,3,2,1); $primes = array(2,3,5,7,11); function simplify(Int $num, Int $denom, Array $primes){ //going from high primes to low primes foreach(array_reverse($primes) as $prime) { if (($num % $prime == 0) && ($denom % $prime == 0)) { return [$num / $prime,$denom / $prime]; } } return [$num,$denom]; } echo "simplify 10:4 = " . implode(':',simplify(10,4,$primes)) . "\n"; echo "simplify 121:22 = " . implode(':',simplify(121,22,$primes)) . "\n"; echo "simplify 5:5 = " . implode(':',simplify(5,5,$primes)) . "\n";
Output for git.master, git.master_jit, rfc.property-hooks
simplify 10:4 = 5:2 simplify 121:22 = 11:2 simplify 5:5 = 1:1

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:
51.45 ms | 405 KiB | 9 Q