3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php //$input = file_get_contents('php://stdin','r'); //$params = explode("\n",$input); $params = [3,3,60,100]; $probes = array_shift($params); function silnia($n) { return ($n <= 1) ? 1 : gmp_mul($n, silnia($n-1)); } function z($silnia) { $strSilnia = (string)$silnia; $zeroCount = 0; for ($i = strlen($strSilnia)-1; $i >= 0; $i--) { if ($strSilnia[$i] == 0) $zeroCount += 1; else break; } echo $zeroCount.PHP_EOL; } for ($i = 0; $i < $probes; $i++) { z(silnia($params[$i])); }
based on lB5HJ
Output for 5.6.8 - 5.6.20, 5.6.28 - 7.0.5, 7.0.20 - 7.2.6
0 14 24
Output for 7.0.6
Fatal error: Uncaught Error: Call to undefined function gmp_mul() in /in/14WJV:10 Stack trace: #0 /in/14WJV(27): silnia(3) #1 {main} thrown in /in/14WJV on line 10
Process exited with code 255.
Output for 5.5.35, 5.6.21
Fatal error: Call to undefined function gmp_mul() in /in/14WJV on line 10
Process exited with code 255.
Output for 5.4.10 - 5.5.34
0 0 0
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/14WJV on line 5
Process exited with code 255.