3v4l.org

run code in 300+ PHP versions simultaneously
<?php // ---------------------- get article info ---------------------- $articles = simplexml_load_file('xml/shoparticles.xml'); // <-- loads local article database //////(1)fetch multpiple article ids: $ids = array('article1' , 'article2', 'article3'); { $output = '<div class="product">'; foreach ($articles->article as $article) { //////(2)fetch multiple article ids: if (in_array($article['id'], $ids)) { // fetch single article id: if ($article['id'] == 'article1') { **execute code** if ($article['id'] == '10012037') { // get the productType resource $productType = simplexml_load_file($article->product->productType->attributes('xlink', true)); $output .= '<li class="clearfix" id="article_'.$article['id'].'"> <form method="post">'; $output .= '<img src="' . (string)$article->resources->resource->attributes('xlink', true) . ',width=560,height=560" alt="' . $article->name . '" class="preview" />'; // add a select with available sizes $output .= '<select id="size-select" name="size">'; foreach($productType->sizes->size as $val) { $output .= '<option value="'.$val['id'].'">'.$val->name.'</option>'; } $output .= '</select>'; // add a list with available colors $output .= '<ul class="colors" name="color">'; $freecolor = $article->product->restrictions->freeColorSelection; $colorid = $article->product->appearance['id']; foreach ($productType->appearances->appearance as $appearance) { //single color articles if ($appearance['id'] == intval($colorid) && $freecolor == "false") { $output .= '<li value="'.$appearance['id'].'">' . '<a href="javascript:void(0)" target="" title="'. $appearance->name .'">' . '<img src="'. $appearance->resources->resource->attributes('xlink', true) .'" alt="'. $appearance->name .'" name="'. $appearance->name .'" /> </a> </li>'; break; } //multi color articles if ($freecolor == "true") { $output .= '<li value="'.$appearance['id'].'">' . '<a href="javascript:void(0)" target="" title="'. $appearance->name .'">' . '<img src="'. $appearance->resources->resource->attributes('xlink', true) .'" alt="'. $appearance->name .'" name="'. $appearance->name .'" /> </a> </li> '; } } $output .= '</ul>'; //quantity $output .= 'quantity: <input type="text" value="1" maxlenght="2" id="quantity" size="1" name="quantity"> <br /><br />'; //show price $output .= 'price: <b>$'. $article->price->vatExcluded .'</b>'; //------hidden inputs for basket creation--------- //appearance/color $output .= '<input type="hidden" ' . 'value="'. $article->product->appearance['id'] .'" id="appearance_'.$article['id'].'" name="appearance" />'; //article id $output .= '<input type="hidden" value="'. $article['id'] .'" id="article_'.$article['id'].'" name="article" />'; //submits all info to basket $output .= '<input type="submit" name="submit" value="Add to basket" style="float:right" /></form></li>'; } //if $article } //for each $article $output .= '</div>'; ?>

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.0180.00416.88
8.3.50.0150.00616.67
8.3.40.0090.00618.92
8.3.30.0190.00418.84
8.3.20.0120.00818.86
8.3.10.0030.00620.66
8.3.00.0100.01017.88
8.2.180.0040.01116.50
8.2.170.0110.00422.96
8.2.160.0110.00422.21
8.2.150.0040.00424.18
8.2.140.0110.00724.66
8.2.130.0040.00426.16
8.2.120.0050.00220.08
8.2.110.0040.00721.16
8.2.100.0070.00718.09
8.2.90.0000.00819.46
8.2.80.0050.00318.30
8.2.70.0100.00317.75
8.2.60.0070.00318.29
8.2.50.0090.00018.07
8.2.40.0040.00418.47
8.2.30.0060.00318.32
8.2.20.0040.00417.87
8.2.10.0030.00719.57
8.2.00.0050.00317.90
8.1.280.0070.01425.92
8.1.270.0050.00324.66
8.1.260.0110.00726.35
8.1.250.0000.00728.09
8.1.240.0100.00022.58
8.1.230.0040.00821.02
8.1.220.0040.00418.77
8.1.210.0050.00319.10
8.1.200.0040.00417.47
8.1.190.0000.00817.68
8.1.180.0040.00418.10
8.1.170.0050.00319.09
8.1.160.0040.00419.00
8.1.150.0000.00818.79
8.1.140.0080.00017.67
8.1.130.0040.00417.86
8.1.120.0000.00717.43
8.1.110.0040.00417.45
8.1.100.0080.00017.64
8.1.90.0050.00217.56
8.1.80.0040.00417.58
8.1.70.0000.00817.63
8.1.60.0000.01017.80
8.1.50.0050.00317.66
8.1.40.0040.00417.53
8.1.30.0050.00317.68
8.1.20.0060.00317.86
8.1.10.0040.00417.64
8.1.00.0000.00817.59
8.0.300.0070.00020.15
8.0.290.0070.00016.88
8.0.280.0000.00718.78
8.0.270.0000.00817.47
8.0.260.0030.00317.05
8.0.250.0040.00417.21
8.0.240.0030.00717.12
8.0.230.0050.00317.05
8.0.220.0000.00717.10
8.0.210.0000.00717.05
8.0.200.0040.00417.01
8.0.190.0040.00417.05
8.0.180.0050.00317.00
8.0.170.0070.00417.12
8.0.160.0070.00016.95
8.0.150.0090.00016.93
8.0.140.0000.00717.04
8.0.130.0030.00513.57
8.0.120.0020.00517.08
8.0.110.0050.00316.86
8.0.100.0030.00617.11
8.0.90.0040.00417.01
8.0.80.0060.00917.13
8.0.70.0050.00216.86
8.0.60.0080.00017.05
8.0.50.0000.00717.16
8.0.30.0060.01317.07
8.0.20.0130.00617.41
8.0.10.0000.00817.20
8.0.00.0080.01016.94
7.4.330.0030.00313.03
7.4.320.0040.00416.69
7.4.300.0000.00716.61
7.4.290.0070.00016.68
7.4.280.0030.00616.77
7.4.270.0040.00416.73
7.4.260.0050.00013.48
7.4.250.0050.00316.70
7.4.240.0030.00316.84
7.4.230.0000.00716.71
7.4.220.0130.00616.74
7.4.210.0080.01016.72
7.4.200.0030.00316.73
7.4.190.0030.00316.80
7.4.160.0070.01716.72
7.4.150.0090.00916.88
7.4.140.0100.01016.62
7.4.130.0120.01016.58
7.4.120.0140.00616.60
7.4.110.0090.00916.61
7.4.100.0090.00916.57
7.4.90.0060.01216.69
7.4.80.0030.01716.87
7.4.70.0060.01816.69
7.4.60.0060.01216.60
7.4.50.0000.00716.50
7.4.40.0030.01016.27
7.4.30.0120.00616.59
7.4.00.0100.00614.94
7.3.330.0000.00613.31
7.3.320.0000.00513.25
7.3.310.0070.00016.16
7.3.300.0040.00416.28
7.3.290.0060.00916.47
7.3.280.0110.00416.35
7.3.270.0140.00316.45
7.3.260.0060.01116.40
7.3.250.0100.01116.46
7.3.240.0110.00716.64
7.3.230.0070.01316.60
7.3.210.0040.01316.77
7.3.200.0060.01319.39
7.3.190.0160.00616.44
7.3.180.0090.00616.30
7.3.170.0120.00616.43
7.3.160.0070.01016.43
7.3.120.0130.00314.83
7.3.110.0040.01514.96
7.3.100.0060.00614.60
7.3.90.0040.00814.55
7.3.80.0030.01215.12
7.3.70.0070.01014.94
7.3.60.0090.00314.71
7.3.50.0070.00314.73
7.3.40.0090.00614.76
7.3.30.0080.00814.81
7.3.20.0040.00716.69
7.3.10.0040.01416.48
7.3.00.0070.00716.76
7.2.330.0150.00316.69
7.2.320.0130.00916.57
7.2.310.0090.01216.64
7.2.300.0040.01316.46
7.2.290.0060.01316.88
7.2.250.0160.00315.26
7.2.240.0030.01715.06
7.2.230.0040.01114.98
7.2.220.0070.00715.23
7.2.210.0080.00615.05
7.2.200.0070.00715.08
7.2.190.0070.01015.21
7.2.180.0080.00914.97
7.2.170.0080.00615.22
7.2.00.0040.01119.52
7.1.330.0030.01015.80
7.1.320.0080.00415.63
7.1.310.0090.00315.76
7.1.300.0030.01216.02
7.1.290.0060.00316.04
7.1.280.0060.00615.82
7.1.270.0040.00815.86
7.1.260.0060.00315.73
7.1.100.0050.00518.13
7.1.70.0000.01017.13
7.1.60.0030.02319.40
7.1.50.0220.00934.55
7.1.00.0030.06322.47
7.0.200.0000.00916.82
7.0.140.0100.07021.96
7.0.120.0030.06322.16
7.0.60.0070.08319.93
7.0.50.0070.05018.01
7.0.40.0070.08020.20
7.0.30.0270.08320.20
7.0.20.0270.06720.27
7.0.10.0230.05720.19
7.0.00.0000.05720.13
5.6.280.0100.09021.18
5.6.210.0100.08320.57
5.6.200.0070.07318.23
5.6.190.0070.08720.71
5.6.180.4070.03720.49
5.6.170.0270.06720.57
5.6.160.0070.06320.57
5.6.150.0000.04318.26
5.6.140.0100.05018.18
5.6.130.0070.09018.34
5.6.120.0130.08021.16
5.6.110.0070.08321.09
5.6.100.0200.06721.04
5.6.90.0130.07721.16
5.6.80.0070.03720.45
5.6.70.3930.03020.51
5.5.350.0170.06720.45
5.5.340.0100.06718.03
5.5.330.0100.04720.51
5.5.320.0300.04720.28
5.5.310.0300.05320.39
5.5.300.0100.07718.04
5.5.290.0030.08318.03
5.5.280.0130.04020.89
5.5.270.0030.04020.91
5.5.260.0070.08021.02
5.5.250.0100.08320.67
5.5.240.0030.04320.41
5.4.450.0070.04019.55
5.4.440.0200.06719.52
5.4.430.0000.04319.18
5.4.420.0070.08019.57
5.4.410.0100.05319.45
5.4.400.0070.06718.96
5.4.390.0170.07019.22
5.4.380.0070.07319.21
5.4.370.0070.05718.90
5.4.360.0070.06719.25
5.4.350.0000.05019.21
5.4.340.0070.07719.25
5.4.320.0000.04319.25
5.4.310.0070.04718.90
5.4.300.0030.04719.01
5.4.290.0000.04719.23
5.4.280.0030.07319.14
5.4.270.0100.03719.14
5.4.260.0030.04319.05
5.4.250.0000.04319.16
5.4.240.0030.07319.24
5.4.230.0100.06318.98
5.4.220.0000.04319.21
5.4.210.0030.04718.98
5.4.200.0000.05319.01
5.4.190.0030.04719.00
5.4.180.0130.05019.14
5.4.170.0030.04018.85
5.4.160.0170.06019.21
5.4.150.0070.04018.97
5.4.140.0130.05316.57
5.4.130.0100.07016.46
5.4.120.0070.07316.50
5.4.110.0030.05316.43
5.4.100.0000.08316.45
5.4.90.0000.08016.42
5.4.80.0070.07716.51
5.4.70.0000.07716.46
5.4.60.0030.07716.37
5.4.50.0070.07016.38
5.4.40.0070.07716.42
5.4.30.0130.07316.51
5.4.20.0100.05316.45
5.4.10.0070.04716.43
5.4.00.0100.07315.88
5.3.290.0100.07314.78
5.3.280.0030.07714.57
5.3.270.0070.07014.69
5.3.260.0100.08014.71
5.3.250.0070.06014.67
5.3.240.0100.06014.66
5.3.230.0100.07314.64
5.3.220.0100.04314.75
5.3.210.0030.08314.63
5.3.200.0000.04714.76
5.3.190.0100.07714.66
5.3.180.0100.06314.60
5.3.170.0030.05314.66
5.3.160.0100.06714.71
5.3.150.0170.08014.67
5.3.140.0130.06714.66
5.3.130.0070.04714.63
5.3.120.0100.07314.64
5.3.110.0070.06314.63
5.3.100.0030.08014.15
5.3.90.0170.06014.09
5.3.80.0000.06714.12
5.3.70.0200.06014.00
5.3.60.0000.05313.95
5.3.50.0070.07014.03
5.3.40.0070.07314.00
5.3.30.0000.07713.99
5.3.20.0100.06013.84
5.3.10.0100.04013.61
5.3.00.0100.06713.63
5.2.170.0100.04011.25
5.2.160.0000.03311.26
5.2.150.0030.04711.23
5.2.140.0030.06711.29
5.2.130.0030.04011.21
5.2.120.0100.05311.21
5.2.110.0070.06011.08
5.2.100.0030.06311.25
5.2.90.0100.05711.06
5.2.80.0100.06011.16
5.2.70.0070.05711.20
5.2.60.0030.06711.15
5.2.50.0070.06311.06
5.2.40.0130.05311.04
5.2.30.0070.03311.01
5.2.20.0100.06011.05
5.2.10.0070.06010.93
5.2.00.0030.03710.71
5.1.60.0030.03710.05
5.1.50.0000.06310.00
5.1.40.0030.04310.09
5.1.30.0000.04310.48
5.1.20.0030.05010.39
5.1.10.0000.03310.16
5.1.00.0030.03010.26
5.0.50.0030.0308.65
5.0.40.0030.0208.45
5.0.30.0000.0708.32
5.0.20.0030.0208.30
5.0.10.0070.0408.18
5.0.00.0000.0338.25
4.4.90.0070.0237.79
4.4.80.0000.0377.79
4.4.70.0030.0237.79
4.4.60.0030.0207.79
4.4.50.0030.0177.79
4.4.40.0030.0277.79
4.4.30.0000.0407.79
4.4.20.0000.0207.79
4.4.10.0000.0237.79
4.4.00.0000.0377.79
4.3.110.0000.0377.79
4.3.100.0030.0137.79
4.3.90.0070.0277.79
4.3.80.0030.0407.79
4.3.70.0030.0307.79
4.3.60.0070.0277.79
4.3.50.0000.0237.79
4.3.40.0000.0337.79
4.3.30.0070.0337.79
4.3.20.0070.0307.79
4.3.10.0000.0307.79
4.3.00.0030.0207.79

preferences:
34.05 ms | 401 KiB | 5 Q