3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x1 = -2.1; $x2 = 0.6; $y1 = -1.2; $y2 = 1.2; $zoom = 100; $iterations_max = 50; $image_x = ($x2 - $x1)*$zoom; $image_y = ($y2 - $y1)*$zoom; // on créé l'image et les couleurs, inutile ici de remplire l'image vu que on dessinera tous les pixels $image = imagecreatetruecolor($image_x, $image_y); $blanc = imagecolorallocate($image, 255, 255, 255); $noir = imagecolorallocate($image, 0, 0, 0); imagefill($image, 0 ,0 , $blanc); // on définit la liste des couleurs du dégradé ici, ça évite de devoir faire appel à imagecoloralocate à chaque pixel $couleurs = array(); for($i = 0; $i < $iterations_max; $i++) $couleur[$i] = imagecolorallocate($image, 0, 0, $i*255/$iterations_max); $debut = microtime(true); for($x = 0; $x < $image_x; $x++){ for($y = 0; $y < $image_y; $y++){ $c_r = $x/$zoom+$x1; $c_i = $y/$zoom+$y1; $z_r = 0; $z_i = 0; $i = 0; do{ $tmp = $z_r; $z_r = $z_r*$z_r - $z_i*$z_i + $c_r; $z_i = 2*$tmp*$z_i + $c_i; $i++; } while($z_r*$z_r + $z_i*$z_i < 4 AND $i < $iterations_max); if($i == $iterations_max) imagesetpixel($image, $x, $y, $noir); else imagesetpixel($image, $x, $y, $couleur[$i]); } } $temps = round(microtime(true) - $debut, 3); imagestring($image, 3, 1, 1, $temps, $blanc); header('Content-type: image/png'); imagepng($image);

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.0060.00919.25
7.1.70.0050.00317.03
7.1.60.0110.01519.46
7.1.50.0130.00934.69
7.1.00.0030.07722.31
7.0.200.0030.00516.74
7.0.140.0070.07021.98
7.0.60.0030.06019.90
7.0.50.0070.07717.84
7.0.40.0070.04720.21
7.0.30.0330.05020.09
7.0.20.0300.08320.18
7.0.10.0330.07019.99
7.0.00.0070.04020.16
5.6.280.0000.07721.16
5.6.210.0100.08320.51
5.6.200.0100.08018.13
5.6.190.0070.04320.77
5.6.180.3170.04320.37
5.6.170.0330.07320.48
5.6.160.0070.04020.52
5.6.150.0100.08318.14
5.6.140.0170.07018.15
5.6.130.0100.04718.16
5.6.120.0070.06720.98
5.6.110.0130.07321.15
5.6.100.0130.07021.03
5.6.90.0100.09021.13
5.6.80.0130.06320.51
5.6.70.0300.06720.50
5.5.350.0130.06320.45
5.5.340.0070.04318.01
5.5.330.0100.04320.47
5.5.320.0570.06020.07
5.5.310.0230.05320.29
5.5.300.0030.08317.95
5.5.290.0030.08017.90
5.5.280.0070.08320.69
5.5.270.0100.05720.87
5.5.260.0100.06720.95
5.5.250.0130.04720.63
5.5.240.0100.07720.16
5.4.450.0700.06319.59
5.4.440.0830.05719.27
5.4.430.0730.06319.55
5.4.420.0700.00019.52
5.4.410.0130.05318.73
5.4.400.0330.04718.62
5.4.390.0200.05018.68
5.4.380.0230.05018.74
5.4.370.0070.04318.66
5.4.360.0070.04018.79
5.4.350.0050.03511.98
5.4.340.0100.03111.98
5.4.320.0050.03612.46
5.4.310.0050.03912.46
5.4.300.0050.03612.47
5.4.290.0060.04612.46
5.4.280.0060.04112.36
5.4.270.0080.04012.36
5.4.260.0070.04512.36
5.4.250.0110.05212.36
5.4.240.0070.05312.36
5.4.230.0060.04512.36
5.4.220.0080.03512.35
5.4.210.0060.03612.36
5.4.200.0090.03612.36
5.4.190.0040.03812.35
5.4.180.0080.03412.35
5.4.170.0070.03612.36
5.4.160.0060.04012.36
5.4.150.0090.04012.36
5.4.140.0110.05612.04
5.4.130.0090.04312.03
5.4.120.0050.03611.98
5.4.110.0050.03711.98
5.4.100.0040.03811.98
5.4.90.0090.03811.98
5.4.80.0090.05411.98
5.4.70.0100.03811.97
5.4.60.0070.03711.98
5.4.50.0080.03811.97
5.4.40.0040.04111.96
5.4.30.0030.04211.96
5.4.20.0050.03811.96
5.4.10.0070.03611.96
5.4.00.0110.04411.45
5.3.290.0060.05312.80
5.3.280.0070.04112.71
5.3.270.0050.04412.73
5.3.260.0090.04512.72
5.3.250.0110.04912.72
5.3.240.0110.05512.72
5.3.230.0090.04612.71
5.3.220.0090.04812.68
5.3.210.0080.04312.68
5.3.200.0070.04412.68
5.3.190.0060.04312.68
5.3.180.0040.03912.67
5.3.170.0050.03912.67
5.3.160.0070.03912.67
5.3.150.0090.04512.67
5.3.140.0080.04112.66
5.3.130.0080.04412.66
5.3.120.0070.05512.66
5.3.110.0080.04112.66
5.3.100.0040.04112.11
5.3.90.0050.03912.09
5.3.80.0070.03912.07
5.3.70.0100.03612.08
5.3.60.0040.04312.07
5.3.50.0040.04012.01
5.3.40.0090.04412.01
5.3.30.0060.05211.96
5.3.20.0080.04811.75
5.3.10.0070.05311.71
5.3.00.0080.05911.70
5.2.170.0040.0479.20
5.2.160.0150.0449.20
5.2.150.0080.0579.20
5.2.140.0080.0499.20
5.2.130.0110.0599.16
5.2.120.0110.0779.16
5.2.110.0140.0439.17
5.2.100.0060.0579.16
5.2.90.0040.0369.16
5.2.80.0020.0339.16
5.2.70.0070.0289.16
5.2.60.0070.0289.11
5.2.50.0070.0299.08
5.2.40.0030.0349.06
5.2.30.0030.0339.04
5.2.20.0050.0429.02
5.2.10.0090.0378.94
5.2.00.0040.0378.80
5.1.60.0070.0348.09
5.1.50.0080.0328.09
5.1.40.0080.0428.06
5.1.30.0070.0458.41
5.1.20.0080.0398.44
5.1.10.0080.0278.17
5.1.00.0090.0238.17
5.0.50.0070.0266.65
5.0.40.0080.0176.51
5.0.30.0080.0276.32
5.0.20.0060.0206.32
5.0.10.0060.0206.30
5.0.00.0040.0336.29
4.4.90.0080.0134.78
4.4.80.0060.0154.75
4.4.70.0020.0194.75
4.4.60.0040.0164.75
4.4.50.0050.0174.77
4.4.40.0070.0264.71
4.4.30.0060.0194.76
4.4.20.0030.0264.85
4.4.10.0020.0184.85
4.4.00.0020.0274.76
4.3.110.0020.0234.67
4.3.100.0050.0194.67
4.3.90.0040.0204.63
4.3.80.0030.0254.58
4.3.70.0030.0144.63
4.3.60.0040.0154.63
4.3.50.0030.0174.63
4.3.40.0080.0334.54
4.3.30.0050.0313.34
4.3.20.0050.0233.32
4.3.10.0050.0213.28
4.3.00.0170.0237.64

preferences:
28.74 ms | 400 KiB | 5 Q