3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Deck{ public $cards = array(); //creates an instance of a deck of cards (works) public function __construct(){ $values =array('2','3','4','5','6','7','8','9','10','J','Q','K','A'); $suits =array('Diamond','Club','Heart','Spade'); foreach ($suits as $suit) { foreach($values as $value){ $this->cards[] = "$value of $suit's"; } } } public function numberOfDecks($number){ $cards = $this->cards; $this->number = $number; for($i = 0 ; $i < $number; $i++){ $this->cards = array_merge($this->cards, $cards); } } } $deck = new Deck();//works as expected // how many cards are intially constructed? echo "count of cards in new deck: " . count($deck->cards) . "\n<br/>\n"; // add 3 more decks of cards $deck->numberOfDecks(3);//trouble echo "count of cards after adding 3 decks: " . count($deck->cards); // $shuffled = shuffle($deck->cards);//works as expected // var_dump($deck);

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.0070.00716.63
8.3.50.0100.00722.06
8.3.40.0150.00018.85
8.3.30.0090.00618.85
8.3.20.0000.00818.63
8.3.10.0040.00421.74
8.3.00.0040.00421.73
8.2.180.0090.00918.50
8.2.170.0110.00322.96
8.2.160.0040.01119.47
8.2.150.0080.00024.18
8.2.140.0090.00024.66
8.2.130.0070.00026.16
8.2.120.0070.00721.00
8.2.110.0060.00321.17
8.2.100.0070.00417.91
8.2.90.0000.00819.88
8.2.80.0030.00517.97
8.2.70.0000.00917.63
8.2.60.0040.00418.03
8.2.50.0180.00318.07
8.2.40.0040.00418.34
8.2.30.0000.00718.21
8.2.20.0040.00418.10
8.2.10.0000.00818.16
8.2.00.0000.00817.71
8.1.280.0130.00725.92
8.1.270.0080.00022.02
8.1.260.0000.00826.35
8.1.250.0080.00028.09
8.1.240.0090.00320.80
8.1.230.0110.00020.91
8.1.220.0040.00417.79
8.1.210.0060.00318.94
8.1.200.0030.00617.48
8.1.190.0030.00617.35
8.1.180.0040.00418.10
8.1.170.0070.00718.71
8.1.160.0040.00418.91
8.1.150.0050.00320.25
8.1.140.0070.00019.66
8.1.130.0030.00517.70
8.1.120.0040.00417.49
8.1.110.0040.00417.40
8.1.100.0030.00617.38
8.1.90.0000.00717.52
8.1.80.0040.00417.51
8.1.70.0000.00817.43
8.1.60.0000.00717.54
8.1.50.0040.00417.59
8.1.40.0040.00417.45
8.1.30.0030.00517.73
8.1.20.0000.00717.71
8.1.10.0060.00317.52
8.1.00.0000.00717.52
8.0.300.0040.00419.98
8.0.290.0000.00716.63
8.0.280.0030.00318.47
8.0.270.0000.00717.28
8.0.260.0000.00617.20
8.0.250.0000.00716.96
8.0.240.0050.00617.00
8.0.230.0050.00216.87
8.0.220.0000.00916.93
8.0.210.0030.00316.85
8.0.200.0000.00716.86
8.0.190.0000.00716.88
8.0.180.0000.00716.84
8.0.170.0000.00816.85
8.0.160.0040.00416.84
8.0.150.0050.00516.90
8.0.140.0060.00316.90
8.0.130.0000.00613.38
8.0.120.0040.00416.86
8.0.110.0050.00316.81
8.0.100.0030.00516.77
8.0.90.0070.00016.89
8.0.80.0120.00916.98
8.0.70.0000.00816.89
8.0.60.0030.00517.02
8.0.50.0000.00716.79
8.0.30.0090.00717.07
8.0.20.0110.00817.40
8.0.10.0000.00716.85
8.0.00.0110.00816.81
7.4.330.0050.00015.55
7.4.320.0050.00216.68
7.4.300.0030.00316.63
7.4.290.0040.00416.57
7.4.280.0060.00316.61
7.4.270.0070.00016.62
7.4.260.0090.00016.61
7.4.250.0000.00716.52
7.4.240.0070.00016.53
7.4.230.0000.00716.54
7.4.220.0070.01716.65
7.4.210.0080.00516.70
7.4.200.0070.00016.42
7.4.160.0090.00616.58
7.4.150.0100.00617.40
7.4.140.0100.00717.86
7.4.130.0100.00816.50
7.4.120.0040.01416.58
7.4.110.0030.01416.43
7.4.100.0080.00916.50
7.4.90.0070.01016.47
7.4.80.0150.00319.39
7.4.70.0060.01016.42
7.4.60.0070.01116.39
7.4.50.0000.01316.33
7.4.40.0160.00316.30
7.4.30.0060.01116.47
7.4.00.0030.01015.14
7.3.330.0000.00513.26
7.3.320.0030.00313.40
7.3.310.0050.00216.43
7.3.300.0000.00816.39
7.3.290.0060.00816.38
7.3.280.0090.00916.37
7.3.270.0130.00617.40
7.3.260.0160.00316.61
7.3.250.0100.00716.30
7.3.240.0100.00816.38
7.3.230.0040.01516.49
7.3.210.0130.00316.61
7.3.200.0060.00916.37
7.3.190.0090.00816.65
7.3.180.0090.01216.39
7.3.170.0090.00816.36
7.3.160.0190.00316.37
7.3.120.0090.00615.13
7.3.110.0090.00615.04
7.3.100.0060.00614.82
7.3.90.0070.01015.12
7.3.80.0100.00715.00
7.3.70.0040.01214.43
7.3.60.0070.01014.61
7.3.50.0030.00915.07
7.3.40.0030.01314.81
7.3.30.0070.01114.98
7.3.20.0120.00016.40
7.3.10.0040.00716.87
7.3.00.0110.00416.50
7.2.330.0110.00716.73
7.2.320.0070.01016.72
7.2.310.0040.01416.82
7.2.300.0110.00716.80
7.2.290.0000.01616.52
7.2.240.0120.00315.29
7.2.230.0100.00715.14
7.2.220.0000.01415.17
7.2.210.0090.00614.98
7.2.200.0000.01815.18
7.2.190.0080.00415.00
7.2.180.0090.00614.82
7.2.170.0070.00714.96
7.2.160.0040.01115.30
7.2.150.0040.01416.99
7.2.140.0000.01316.73
7.2.130.0100.00317.16
7.2.120.0080.00816.94
7.2.110.0050.01016.86
7.2.100.0050.00516.81
7.2.90.0030.01016.76
7.2.80.0040.01016.85
7.2.70.0070.00516.66
7.2.60.0070.01017.02
7.2.50.0040.01117.03
7.2.40.0030.01016.60
7.2.30.0060.00716.88
7.2.20.0030.00816.83
7.2.10.0050.00716.93
7.2.00.0040.01117.73
7.1.330.0030.01415.65
7.1.320.0030.00715.90
7.1.310.0060.00915.94
7.1.300.0100.00615.98
7.1.290.0070.00715.78
7.1.280.0110.00415.70
7.1.270.0040.01115.85
7.1.260.0060.01015.93
7.1.250.0060.00915.56
7.1.230.0030.00615.86
7.1.220.0030.00615.86
7.1.210.0040.00715.71
7.1.200.0060.00515.96
7.1.190.0040.00415.91
7.1.180.0050.00316.01
7.1.170.0000.01315.92
7.1.160.0000.00815.99
7.1.150.0050.00315.65
7.1.140.0030.00915.89
7.1.130.0040.00715.84
7.1.120.0000.01115.99
7.1.110.0080.00015.91
7.1.100.0060.00315.96
7.1.90.0100.00015.90
7.1.80.0000.00715.88
7.1.70.0050.00316.25
7.1.60.0100.00316.61
7.1.50.0000.01715.80
7.1.40.0060.01016.03
7.1.30.0040.01115.98
7.1.20.0090.00615.63
7.1.10.0030.01015.56
7.1.00.0050.04018.90
7.0.310.0070.00415.32
7.0.300.0030.00615.45
7.0.290.0040.00715.18
7.0.280.0040.00815.18
7.0.270.0090.00315.11
7.0.260.0060.00615.46
7.0.250.0060.00615.20
7.0.240.0090.00315.52
7.0.230.0040.00715.41
7.0.220.0060.00615.33
7.0.210.0030.01015.54
7.0.200.0150.00815.23
7.0.190.0060.00315.55
7.0.180.0040.00715.53
7.0.170.0030.00615.48
7.0.160.0030.00715.46
7.0.150.0000.01215.42
7.0.140.0030.01015.54
7.0.130.0090.00615.36
7.0.120.0040.03418.89
7.0.110.0060.03318.82
7.0.100.0050.03318.79
7.0.90.0030.03718.79
7.0.80.0050.03318.64
7.0.70.0100.03118.57
7.0.60.0100.03018.70
7.0.50.0060.03018.78
7.0.40.0080.02817.90
7.0.30.0070.03017.84
7.0.20.0080.03317.70
7.0.10.0100.03017.81
7.0.00.0070.03217.67
5.6.380.0070.00714.75
5.6.370.0000.01514.69
5.6.360.0050.00314.39
5.6.350.0090.00314.41
5.6.340.0070.00314.46
5.6.330.0000.01114.71
5.6.320.0000.01314.74
5.6.310.0000.00814.51
5.6.300.0100.00314.70
5.6.290.0060.00614.78
5.6.280.0050.00314.50
5.6.270.0050.03417.66
5.6.260.0040.03517.82
5.6.250.0030.03517.79
5.6.240.0040.03517.77
5.6.230.0000.03617.92
5.6.220.0100.04617.65
5.6.210.0140.03217.77
5.6.200.0090.03117.94
5.6.190.0100.02817.90
5.6.180.0040.03717.74
5.6.170.0080.03317.67
5.6.160.0070.02817.78
5.6.150.0050.04317.94
5.6.140.0080.03217.73
5.6.130.0070.03117.82
5.6.120.0110.02617.64
5.6.110.0070.03317.52
5.6.100.0070.03317.80
5.6.90.0050.03817.84
5.6.80.0110.03917.41
5.6.70.0080.02817.30
5.6.60.0030.03317.50
5.6.50.0060.03117.38
5.6.40.0070.04217.49
5.6.30.0080.03117.24
5.6.20.0130.02717.39
5.6.10.0090.03017.54
5.6.00.0100.02517.38

preferences:
57.56 ms | 401 KiB | 5 Q