3v4l.org

run code in 300+ PHP versions simultaneously
<?php if(isset($_GET['action'])){ if ($_GET['action']=='empty'){ $url="index.php"; if(isset($_SESSION['cart'])){ echo "<h1>Emptying Cart</h1>"; unset($_SESSION['cart']); goto endoption; } goto endoption; } if($_GET['action']=='imgremove'){ $url="index.php?page=cart"; foreach($_SESSION['cart'] as $key=>$value){ foreach($value as $subkey=>$subvalue){ if($subvalue==$_GET['pic']){ unset($_SESSION['cart'][$key]); if(count($_SESSION['cart'])=='0'){ unset($_SESSION['cart']); } goto endoption; } } } } if($_GET['action']=='itemremove'){ $url="index.php?page=cart"; foreach($_SESSION['cart'] as $key=>$value){ foreach($value as $subkey=>$subvalue){ if($subvalue==$_GET['pic']){ foreach($_SESSION['cart'][$key]['details'] as $dkey => $dvalue){ foreach($dvalue as $detail){ if($detail==$_GET['option']){ unset($_SESSION['cart'][$key]['details'][$dkey]); if(count($_SESSION['cart'][$key]['details'])=='0'){ unset($_SESSION['cart'][$key]); } if(count($_SESSION['cart'])=='0'){ unset($_SESSION['cart']); } goto endoption; } } } } } } } } else{ if($_GET['currentpage']=='cart'){ $url="index.php?page=cart"; } else{ $url="index.php?page=".$_GET['currentpage']."&location=".$_GET['location']."&venue=".$_GET['venue']."&session=".$_GET['session']."&pic=".$_GET['pic']; } if (!isset($_SESSION['cart'])) { $_SESSION['cart'][] = array( "pic" => $_POST['pic'], "details" => [] ); $_SESSION['cart'][0]['details'][]= array( "option" => $_POST['option'], "quantity" => $_POST['quantity'] ); goto endoption; } else{ foreach($_SESSION['cart'] as $key=>$value){ foreach($value as $subkey=>$subvalue){ if($subvalue==$_POST['pic']){ foreach($_SESSION['cart'][$key]['details'] as $dkey => $dvalue){ foreach($dvalue as $detail){ if($detail==$_POST['option']){ if($_POST['quantity']=='0'){ unset($_SESSION['cart'][$key]['details'][$dkey]); if(count($_SESSION['cart'][$key]['details'])=='0'){ unset($_SESSION['cart'][$key]); if(count($_SESSION['cart'])=='0'){ unset($_SESSION['cart']); } } goto endoption; } else{ $_SESSION['cart'][$key]['details'][$dkey]['quantity']=$_POST['quantity']; goto endoption; } } } } $_SESSION['cart'][$key]['details'][]=array( "option"=> $_POST['option'], "quantity" => $_POST['quantity'] ); goto endoption; } } } $_SESSION['cart'][] = array( "pic" => $_POST['pic'], "details" => [] ); foreach($_SESSION['cart'] as $key=>$value){ foreach($value as $subkey=>$subvalue){ if($subvalue==$_POST['pic']){ $_SESSION['cart'][$key]['details'][]= array( "option" => $_POST['option'], "quantity" => $_POST['quantity'] ); } } } goto endoption; } } endoption: header("Location: $url"); die();

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)
8.3.60.0100.01018.27
8.3.50.0150.00721.20
8.3.40.0170.00318.91
8.3.30.0130.00719.04
8.3.20.0080.00020.33
8.3.10.0040.00421.73
8.3.00.0050.00317.71
8.2.180.0070.00718.41
8.2.170.0120.00322.96
8.2.160.0100.00320.47
8.2.150.0040.00424.18
8.2.140.0030.00624.66
8.2.130.0040.00426.16
8.2.120.0050.00319.35
8.2.110.0070.00322.34
8.2.100.0060.00618.03
8.2.90.0030.00518.47
8.2.80.0030.00518.07
8.2.70.0060.00317.75
8.2.60.0050.00318.00
8.2.50.0090.00017.75
8.2.40.0060.00318.47
8.2.30.0040.00419.90
8.2.20.0040.00417.92
8.2.10.0040.00418.15
8.2.00.0000.00718.30
8.1.280.0110.00425.92
8.1.270.0080.00020.52
8.1.260.0030.00626.35
8.1.250.0070.00028.09
8.1.240.0030.00623.96
8.1.230.0090.00322.63
8.1.220.0090.00017.89
8.1.210.0090.00318.90
8.1.200.0030.00917.48
8.1.190.0040.00417.48
8.1.180.0080.00018.10
8.1.170.0050.00318.79
8.1.160.0070.00019.01
8.1.150.0050.00319.00
8.1.140.0040.00417.62
8.1.130.0000.00717.94
8.1.120.0040.00417.62
8.1.110.0040.00417.57
8.1.100.0000.00717.53
8.1.90.0040.00417.51
8.1.80.0030.00517.52
8.1.70.0000.00717.60
8.1.60.0040.00417.58
8.1.50.0000.00917.51
8.1.40.0040.00417.51
8.1.30.0080.00017.83
8.1.20.0070.00017.66
8.1.10.0000.00817.50
8.1.00.0040.00417.64
8.0.300.0040.00419.98
8.0.290.0040.00416.88
8.0.280.0070.00018.59
8.0.270.0000.00817.32
8.0.260.0000.00717.37
8.0.250.0000.00717.18
8.0.240.0030.00617.11
8.0.230.0040.00417.13
8.0.220.0070.00017.00
8.0.210.0040.00417.04
8.0.200.0030.00317.01
8.0.190.0000.00717.04
8.0.180.0040.00417.06
8.0.170.0070.00017.16
8.0.160.0040.00417.07
8.0.150.0040.00417.07
8.0.140.0040.00417.05
8.0.130.0050.00313.52
8.0.120.0030.00617.05
8.0.110.0050.00317.06
8.0.100.0080.00016.94
8.0.90.0080.00017.08
8.0.80.0090.00617.08
8.0.70.0080.00016.95
8.0.60.0000.00717.01
8.0.50.0070.00017.07
8.0.30.0110.01117.02
8.0.20.0170.00617.40
8.0.10.0040.00417.19
8.0.00.0080.01316.88
7.4.330.0000.00615.03
7.4.320.0000.00716.66
7.4.300.0030.00316.71
7.4.290.0000.00716.62
7.4.280.0000.00816.61
7.4.270.0030.00316.53
7.4.260.0000.00816.53
7.4.250.0040.00416.68
7.4.240.0070.00016.60
7.4.230.0000.00716.69
7.4.220.0140.00316.68
7.4.210.0040.01716.56
7.4.200.0070.00016.70
7.4.160.0090.00616.51
7.4.150.0120.01217.40
7.4.140.0110.00917.86
7.4.130.0130.00916.71
7.4.120.0100.00816.54
7.4.110.0030.01616.82
7.4.100.0080.01216.57
7.4.90.0130.00616.63
7.4.80.0100.01319.39
7.4.70.0060.01116.57
7.4.60.0100.00716.60
7.4.50.0000.00816.81
7.4.40.0060.01116.41
7.4.30.0120.00616.75
7.4.10.0040.01115.23
7.4.00.0060.01015.13
7.3.330.0050.00013.35
7.3.320.0000.00513.19
7.3.310.0000.00716.37
7.3.300.0000.00716.54
7.3.290.0060.01116.52
7.3.280.0050.01016.50
7.3.270.0150.00317.40
7.3.260.0110.00616.63
7.3.250.0120.01116.55
7.3.240.0060.01116.55
7.3.230.0070.01116.78
7.3.210.0110.00716.59
7.3.200.0110.00719.39
7.3.190.0100.01316.46
7.3.180.0090.00616.49
7.3.170.0070.01016.56
7.3.160.0130.00316.68
7.3.130.0100.01014.92
7.3.120.0070.01015.20
7.3.110.0130.00315.06
7.3.100.0100.00715.04
7.3.90.0030.00615.19
7.3.80.0070.00415.07
7.3.70.0000.01314.64
7.3.60.0040.00414.83
7.3.50.0030.00915.04
7.3.40.0110.00314.85
7.3.30.0140.00015.05
7.3.20.0040.01116.74
7.3.10.0040.00716.69
7.3.00.0060.00916.83
7.2.330.0120.01516.76
7.2.320.0090.01516.72
7.2.310.0080.01116.79
7.2.300.0060.01216.85
7.2.290.0150.00816.69
7.2.260.0070.01315.37
7.2.250.0080.01114.89
7.2.240.0000.01615.36
7.2.230.0000.00915.20
7.2.220.0060.00615.09
7.2.210.0100.00314.77
7.2.200.0030.01014.99
7.2.190.0060.00915.25
7.2.180.0080.00315.00
7.2.170.0000.00915.23
7.2.160.0030.01215.02
7.2.150.0040.00817.16
7.2.140.0080.00416.91
7.2.130.0090.00616.78
7.2.120.0060.00617.05
7.2.110.0000.01016.94
7.2.100.0000.01017.11
7.2.90.0080.00617.02
7.2.80.0030.01016.95
7.2.70.0150.00316.95
7.2.60.0090.00317.05
7.2.50.0100.00317.04
7.2.40.0040.01117.00
7.2.30.0040.01116.93
7.2.20.0040.01116.95
7.2.10.0060.00617.04
7.2.00.0070.00418.38
7.1.330.0040.01115.81
7.1.320.0060.00315.60
7.1.310.0030.01015.63
7.1.300.0080.00315.85
7.1.290.0000.00916.04
7.1.280.0040.00416.00
7.1.270.0060.00916.01
7.1.260.0060.00615.83
7.1.250.0060.00615.56
7.1.240.0030.01015.77
7.1.230.0040.00715.88
7.1.220.0060.00915.54
7.1.210.0050.00515.49
7.1.200.0050.00715.68
7.1.190.0060.00315.65
7.1.180.0090.00015.81
7.1.170.0000.01015.84
7.1.160.0040.01115.84
7.1.150.0030.01115.90
7.1.140.0030.01015.72
7.1.130.0060.00915.81
7.1.120.0000.00815.62
7.1.110.0000.01215.65
7.1.100.0060.00817.11
7.1.90.0080.00816.00
7.1.80.0000.01315.83
7.1.70.0040.00416.25
7.1.60.0070.01217.72
7.1.50.0060.01416.32
7.1.40.0090.00615.61
7.1.30.0000.01315.72
7.1.20.0000.01315.76
7.1.10.0080.00415.72
7.1.00.0060.03919.03
7.0.330.0000.01115.36
7.0.320.0060.00615.51
7.0.310.0030.01015.22
7.0.300.0060.00615.29
7.0.290.0100.00315.34
7.0.280.0030.01015.09
7.0.270.0070.01015.48
7.0.260.0080.00415.11
7.0.250.0070.00715.39
7.0.240.0080.00415.41
7.0.230.0000.01415.62
7.0.220.0070.00715.19
7.0.210.0000.01215.52
7.0.200.0030.00616.08
7.0.190.0060.00615.23
7.0.180.0060.00615.43
7.0.170.0030.01015.52
7.0.160.0030.01015.27
7.0.150.0030.01015.18
7.0.140.0000.01315.50
7.0.130.0040.01115.39
7.0.120.0090.00615.31
7.0.110.0060.00915.54
7.0.100.0040.03717.79
7.0.90.0080.04517.56
7.0.80.0070.04317.69
7.0.70.0030.04617.75
7.0.60.0050.04517.76
7.0.50.0280.04817.93
7.0.40.0070.04016.80
7.0.30.0100.02716.66
7.0.20.0100.04016.78
7.0.10.0050.04216.84
7.0.00.0030.04316.67
5.6.400.0030.01014.58
5.6.390.0000.01414.80
5.6.380.0070.00714.29
5.6.370.0030.01214.55
5.6.360.0040.01114.78
5.6.350.0080.00614.71
5.6.340.0030.00614.50
5.6.330.0070.00714.48
5.6.320.0000.01514.53
5.6.310.0030.00714.74
5.6.300.0070.00714.76
5.6.290.0120.00314.55
5.6.280.0070.03717.82
5.6.270.0100.00314.21
5.6.260.0140.00314.59
5.6.250.0020.04817.70
5.6.240.0080.04417.54
5.6.230.0090.04417.80
5.6.220.0050.03117.63
5.6.210.0100.04317.56
5.6.200.0020.05017.68
5.6.190.0070.04917.91
5.6.180.0060.04117.85
5.6.170.0080.04617.99
5.6.160.0080.04517.87
5.6.150.0080.04117.85
5.6.140.0040.04517.91
5.6.130.0100.04417.77
5.6.120.0020.03417.80
5.6.110.0050.02417.90
5.6.100.0070.02417.72
5.6.90.0050.02617.79
5.6.80.0050.03317.45
5.6.70.0030.02817.38
5.6.60.0050.02317.47
5.6.50.0110.03917.49
5.6.40.0070.02417.38
5.6.30.0070.03217.44
5.6.20.0070.04517.46
5.6.10.0050.02317.27
5.6.00.0020.04817.40
5.5.380.0080.03517.49
5.5.370.0070.04417.53
5.5.360.0080.04317.40
5.5.350.0130.03817.34
5.5.340.0100.03817.76
5.5.330.0130.03717.72
5.5.320.0020.04917.65
5.5.310.0030.03817.76
5.5.300.0050.04217.59
5.5.290.0100.04417.62
5.5.280.0020.03517.56
5.5.270.0020.03017.63
5.5.260.0030.02917.60
5.5.250.0070.02417.69
5.5.240.0030.02417.42
5.5.230.0020.02617.40
5.5.220.0060.04317.26
5.5.210.0070.04017.26
5.5.200.0080.04217.28
5.5.190.0020.02717.21
5.5.180.0060.02617.38
5.5.170.0080.00314.44
5.5.160.0050.02517.42
5.5.150.0030.03617.38
5.5.140.0090.04417.40
5.5.130.0080.04217.40
5.5.120.0040.02517.29
5.5.110.0080.03317.32
5.5.100.0030.02617.18
5.5.90.0070.02317.31
5.5.80.0080.01717.26
5.5.70.0030.03417.31
5.5.60.0070.01817.11
5.5.50.0020.02817.33
5.5.40.0030.04117.33
5.5.30.0080.02217.09
5.5.20.0050.02417.40
5.5.10.0080.02317.27
5.5.00.0100.01717.26
5.4.450.0110.03515.33
5.4.440.0050.04215.34
5.4.430.0030.02315.28
5.4.420.0020.02515.36
5.4.410.0020.02215.21
5.4.400.0020.02315.03
5.4.390.0000.02515.15
5.4.380.0110.03015.05
5.4.370.0070.03515.15
5.4.360.0050.04015.01
5.4.350.0020.02415.04
5.4.340.0030.02215.17
5.4.330.0060.00611.06
5.4.320.0000.02615.09
5.4.310.0080.03815.06
5.4.300.0050.01915.10
5.4.290.0070.03315.06
5.4.280.0050.02815.21
5.4.270.0100.01715.01
5.4.260.0000.02414.89
5.4.250.0030.02215.23
5.4.240.0030.02515.12
5.4.230.0030.02015.04
5.4.220.0060.01815.05
5.4.210.0060.01915.09
5.4.200.0040.02315.03
5.4.190.0020.02414.95
5.4.180.0050.02114.95
5.4.170.0020.03215.11
5.4.160.0030.02215.10
5.4.150.0030.02315.08
5.4.140.0050.02013.67
5.4.130.0070.01813.77
5.4.120.0030.02213.69
5.4.110.0060.02113.67
5.4.100.0030.02113.69
5.4.90.0020.02113.84
5.4.80.0050.02013.78
5.4.70.0050.02213.86
5.4.60.0020.02113.60
5.4.50.0050.02013.72
5.4.40.0050.02013.73
5.4.30.0040.02013.78
5.4.20.0040.02213.76
5.4.10.0050.02813.71
5.4.00.0020.02213.41

preferences:
35.26 ms | 401 KiB | 5 Q