3v4l.org

run code in 300+ PHP versions simultaneously
<?php $logfile = fopen('/tmp/out', 'w+'); function test($logfile) { $chars = '0123456789abcdefghijklmnopqrstuvwxyz'; $base = mt_rand(2, 36); $len = mt_rand(10, 100); $str = ''; for ($i = 0; $i < $len; ++$i) { $str .= $chars[mt_rand(0, $base - 1)]; } fprintf($logfile, "base %s value %s\n", $base, $str); $gmp = gmp_init($str, $base); $val = gmp_strval($str, $base); $val = str_pad($val, strlen($str), '0', STR_PAD_LEFT); if ($val !== $str) { throw new Exception('Not same - base '.$base."\n-".$str."\n+".$val); } } for($i = 0; $i < 100000; ++$i) { test($logfile); }
Output for git.master_jit
Fatal error: Uncaught ValueError: gmp_strval(): Argument #1 ($num) is not an integer string in /in/Oo2JU:14 Stack trace: #0 /in/Oo2JU(14): gmp_strval('97f3168i7e79e25...', 20) #1 /in/Oo2JU(22): test(Resource id #5) #2 {main} thrown in /in/Oo2JU on line 14
Process exited with code 255.
Output for git.master
Fatal error: Uncaught ValueError: gmp_strval(): Argument #1 ($num) is not an integer string in /in/Oo2JU:14 Stack trace: #0 /in/Oo2JU(14): gmp_strval('e070e6e405713ee...', 16) #1 /in/Oo2JU(22): test(Resource id #5) #2 {main} thrown in /in/Oo2JU on line 14
Process exited with code 255.

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:
34.57 ms | 401 KiB | 7 Q