3v4l.org

run code in 300+ PHP versions simultaneously
<?php session_start(); // Zufaelligen captchastring erstellen function random_string() { $chars = 'ABCDEFGHKLMNPQRSTUVWXYZ23456789'; $string = ''; $i = 1; $max = 5; while ($i <= $max) { $char = substr($chars,rand(0,strlen($chars)-1),1); $string .= $char; $i++; } return $string; } // captcha code ausgeben function get_captcha() { $old = time()-(60*20); if (empty($_SESSION['captcha'])) return null; if ($_SESSION['captcha']['date'] < $old) return null; return $_SESSION['captcha']['code']; } // captcha erstellen function make_captcha() { unset($_SESSION['captcha']); $string = random_string(); $width = 200; $height = 75; $font = 'captcha.ttf'; $one = imagecreate($width,$height); $two = imagecreate($width,$height); $bgone = imagecolorallocate($one,0,0,0); $txtone = imagecolorallocate($one,255,255,255); $bgtwo = imagecolorallocate($two,255,255,255); $txttwo = imagecolorallocate($two, 0, 0, 0); //imagettftext($one,32,0,10,$height-20,$txtone,$font,$string); $y = 0; while ($y < $height) { $x = 0; while ($x < $width) { $r = rand(1,2); if ($r == 1) { $dot = imagecolorat($one,$x,$y); if ($dot == 0) { imagesetpixel($two,$x,$y,$txttwo); imagesetpixel($one,$x,$y,$txtone); } else { imagesetpixel($one,$x,$y,$bgone); imagesetpixel($two,$x,$y,$txttwo); } } $x++; } $y++; } imagecolortransparent($one,$txtone); imagecolortransparent($two,$bgtwo); $old_content = ob_get_contents(); ob_clean(); imagepng($one); $imgone = ob_get_contents(); ob_clean(); imagepng($two); $imgtwo = ob_get_contents(); ob_clean(); echo $old_content; $_SESSION['captcha'] = array('code'=>$string,'date'=>time()); $audiostring = implode('+.', str_split($string)); return '<div style="background-image:url(data:image/png;base64,'. base64_encode($imgone).');background-repeat:no-repeat;background-color:#FFFFFF;width:'.($width).';"><img src="data:image/png;base64,'. base64_encode($imgtwo).'" border="0" /></div>' . '<audio controls autoplay style="width:200px;"><source src="data:audio/mpeg;base64,' . base64_encode(file_get_contents('http://translate.google.com/translate_tts?tl=de&q=' . $audiostring)) . '" type="audio/mpeg"></audio>'; } die(make_captcha());

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
7.2.00.0080.00819.60
7.1.70.0070.00316.92
7.1.60.0720.00315.36
7.1.50.0000.01816.96
7.1.00.0100.07022.42
7.0.200.0060.00916.64
7.0.140.0070.07022.07
7.0.100.0030.06720.00
7.0.90.0070.08719.94
7.0.80.0130.07719.90
7.0.70.0170.04720.03
7.0.60.0030.07320.05
7.0.50.0070.07320.30
7.0.40.0130.07720.05
7.0.30.0070.05320.13
7.0.20.0030.06720.09
7.0.10.0030.08020.12
7.0.00.0130.08020.04
5.6.280.0070.09021.15
5.6.250.0070.04020.85
5.6.240.0070.04720.62
5.6.230.0070.07020.66
5.6.220.0070.07720.75
5.6.210.0070.08720.47
5.6.200.0130.08021.16
5.6.190.0100.07721.09
5.6.180.0100.08721.13
5.6.170.0070.08721.04
5.6.160.0100.08021.11
5.6.150.0130.07021.11
5.6.140.0070.08721.05
5.6.130.0100.08021.05
5.6.120.0070.07720.98
5.6.110.0130.05320.99
5.6.100.0170.06021.06
5.6.90.0070.08021.03
5.6.80.0130.07720.43
5.6.70.0030.05020.32
5.6.60.0070.08320.46
5.6.50.0200.06720.46
5.6.40.0130.08020.40
5.6.30.0070.08020.41
5.6.20.0070.07020.32
5.6.10.0030.08320.46
5.6.00.0200.07020.30
5.5.380.0100.08320.59
5.5.370.0230.06720.58
5.5.360.0130.07020.43
5.5.350.0070.04720.45
5.5.340.0130.04720.93
5.5.330.0070.06020.85
5.5.320.0170.07320.85
5.5.310.0200.03720.80
5.5.300.0070.08720.88
5.5.290.0070.08720.91
5.5.280.0130.07320.85
5.5.270.0030.06020.81
5.5.260.0130.05320.76
5.5.250.0070.08020.77
5.5.240.0100.04320.20
5.5.230.0100.08020.13
5.5.220.0100.08020.29
5.5.210.0200.06720.30
5.5.200.0000.05320.18
5.5.190.0070.05020.21
5.5.180.0000.05320.18
5.5.160.0030.08020.29
5.5.150.0070.05020.16
5.5.140.0070.06720.25
5.5.130.0170.07020.11
5.5.120.0170.07320.13
5.5.110.0130.07320.16
5.5.100.0000.05320.14
5.5.90.0070.04020.07
5.5.80.0030.07720.06
5.5.70.0000.09020.04
5.5.60.0070.07020.08
5.5.50.0070.04320.16
5.5.40.0130.07320.05
5.5.30.0130.07720.17
5.5.20.0070.08320.16
5.5.10.0100.07320.15
5.5.00.0100.07720.14
5.4.450.0000.07019.45
5.4.440.0100.07019.38
5.4.430.0100.08019.46
5.4.420.0070.07319.53
5.4.410.0100.08019.25
5.4.400.0100.07719.04
5.4.390.0100.07018.90
5.4.380.0100.07718.88
5.4.370.0100.07019.05
5.4.360.0030.07019.12
5.4.350.0030.04019.04
5.4.340.0030.06018.95
5.4.320.0030.07319.14
5.4.310.0030.07719.16
5.4.300.0100.04018.90
5.4.290.0100.06319.12
5.4.280.0100.05319.04
5.4.270.0070.08019.13
5.4.260.0170.07318.94
5.4.250.0130.06719.17
5.4.240.0170.07019.14
5.4.230.0100.07019.22
5.4.220.0000.07018.94
5.4.210.0070.07319.12
5.4.200.0100.05319.11
5.4.190.0030.08019.12
5.4.180.0100.07319.13
5.4.170.0030.08018.85
5.4.160.0000.08019.10
5.4.150.0100.07719.02
5.4.140.0000.04016.34
5.4.130.0000.07016.45
5.4.120.0030.07316.34
5.4.110.0030.06716.33
5.4.100.0070.07316.57
5.4.90.0130.07016.56
5.4.80.0130.04016.48
5.4.70.0070.04316.51
5.4.60.0130.03316.42
5.4.50.0130.07016.28
5.4.40.0170.06016.41
5.4.30.0100.05316.48
5.4.20.0030.07716.26
5.4.10.0070.07016.45
5.4.00.0100.06715.82
5.3.290.0070.07714.74
5.3.280.0100.07314.68
5.3.270.0030.07714.55
5.3.260.0030.08314.64
5.3.250.0100.04014.72
5.3.240.0030.06714.66
5.3.230.0030.04714.57
5.3.220.0100.04714.55
5.3.210.0030.04014.59
5.3.200.0000.05014.60
5.3.190.0070.07314.73
5.3.180.0070.07314.52
5.3.170.0070.05714.70
5.3.160.0100.07314.59
5.3.150.0030.08014.70
5.3.140.0070.07314.59
5.3.130.0030.07714.63
5.3.120.0000.07314.59
5.3.110.0100.06314.58
5.3.100.0130.04314.08
5.3.90.0100.07014.02
5.3.80.0030.05313.97
5.3.70.0070.06014.11
5.3.60.0100.06314.04
5.3.50.0030.07714.11
5.3.40.0030.06314.11
5.3.30.0000.08313.91
5.3.20.0030.07013.72
5.3.10.0070.07013.63
5.3.00.0070.04713.56
5.2.170.0030.06311.66
5.2.160.0030.06311.66
5.2.150.0000.06711.66
5.2.140.0170.05011.66
5.2.130.0100.05711.66
5.2.120.0070.03011.66
5.2.110.0070.06011.66
5.2.100.0070.05711.66
5.2.90.0070.06011.66
5.2.80.0070.03711.66
5.2.70.0070.05011.66
5.2.60.0070.05011.66
5.2.50.0070.05311.66
5.2.40.0030.06011.66
5.2.30.0030.06011.66
5.2.20.0000.04311.66
5.2.10.0030.05711.66
5.2.00.0000.06711.66
5.1.60.0100.02711.66
5.1.50.0030.03011.66
5.1.40.0070.04311.66
5.1.30.0130.04011.66
5.1.20.0070.03711.66
5.1.10.0000.05711.66
5.1.00.0030.05711.66
5.0.50.0070.02711.66
5.0.40.0100.02711.66
5.0.30.0000.06711.66
5.0.20.0030.02711.66
5.0.10.0000.04011.66
5.0.00.0030.06711.66
4.4.90.0000.03711.66
4.4.80.0030.03011.66
4.4.70.0030.03311.66
4.4.60.0100.02011.66
4.4.50.0000.02311.66
4.4.40.0000.03011.66
4.4.30.0070.03311.66
4.4.20.0000.03711.66
4.4.10.0000.02711.66
4.4.00.0070.05311.66
4.3.110.0000.03711.66
4.3.100.0070.03311.66
4.3.90.0000.02011.66
4.3.80.0030.05711.66
4.3.70.0030.03711.66
4.3.60.0100.02311.66
4.3.50.0000.02711.66
4.3.40.0000.05311.66
4.3.30.0000.03711.66
4.3.20.0030.01711.66
4.3.10.0030.03011.66
4.3.00.0030.03311.66

preferences:
37.61 ms | 401 KiB | 5 Q