3v4l.org

run code in 300+ PHP versions simultaneously
<?php # Acknowledging Stas Malyshev # https://phabricator.wikimedia.org/T156364#2977719 # Given two classes with the same property name but different visibility class WithPublic { public $property; function __construct( $p ) { $this->property = $p; } function getProperty() { print $this->property; } } class WithPrivate { private $property; function __construct( $p ) { $this->property = $p; } function getProperty() { print $this->property; } } $pub = new WithPublic( 'value' ); # Lets pretend it is held in a permanent cache: $cache = serialize( $pub ); # Later on NEW code is deployed which change the property signature to private. # Simulate the class changed: $mut_pub_to_priv = unserialize( str_replace( '10:"WithPublic"', '11:"WithPrivate"', $cache ) ); var_dump( $mut_pub_to_priv ); # class WithPrivate#2 (2) { # private $property => # NULL # public $property => # string(5) "value" # } var_export( $mut_pub_to_priv->getProperty() ); # NULL # The object restored from cache is not quite the one we expected and cause # some havoc ( https://phabricator.wikimedia.org/T156364 ). Then Zend and HHVM # consistently yield "NULL". # The other way around. Cache with private property restore to class with # public property $priv = new WithPrivate( 'value' ); $cache = serialize( $priv ); $mut_priv_to_pub = unserialize( str_replace( '11:"WithPrivate"', '10:"WithPublic"', $cache) ); var_dump( $mut_priv_to_pub ); # class WithPublic#4 (2) { # public $property => # NULL # private $property => # string(5) "value" # } var_export( $mut_priv_to_pub->getProperty() ); # On Zend PHP: NULL # On HHVM 3.15.4, 3.17.1: valueNULL

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.70.0130.00616.61
8.3.60.0110.00716.63
8.3.50.0130.00722.90
8.3.40.0090.00618.79
8.3.30.0090.00618.89
8.3.20.0040.00421.73
8.3.10.0000.00721.84
8.3.00.0050.00320.59
8.2.190.0060.01516.75
8.2.180.0140.00718.29
8.2.170.0090.00622.96
8.2.160.0100.00320.35
8.2.150.0070.00324.18
8.2.140.0060.00324.66
8.2.130.0040.00419.64
8.2.120.0040.00426.35
8.2.110.0060.00319.27
8.2.100.0100.00717.97
8.2.90.0000.00819.17
8.2.80.0040.00417.97
8.2.70.0050.00317.80
8.2.60.0040.00418.16
8.2.50.0000.00818.10
8.2.40.0040.00420.61
8.2.30.0040.00419.27
8.2.20.0000.00818.07
8.2.10.0070.00017.95
8.2.00.0050.00317.61
8.1.280.0040.01125.92
8.1.270.0030.00622.20
8.1.260.0070.00726.35
8.1.250.0000.00828.09
8.1.240.0070.00424.03
8.1.230.0070.00417.64
8.1.220.0030.00617.74
8.1.210.0000.00818.77
8.1.200.0090.00017.35
8.1.190.0040.00417.35
8.1.180.0000.00818.10
8.1.170.0040.00418.90
8.1.160.0040.00418.91
8.1.150.0070.00020.20
8.1.140.0000.00719.59
8.1.130.0040.00419.05
8.1.120.0000.00717.48
8.1.110.0030.00517.32
8.1.100.0000.00717.34
8.1.90.0030.00417.42
8.1.80.0040.00417.46
8.1.70.0040.00417.32
8.1.60.0060.00617.49
8.1.50.0000.00817.44
8.1.40.0040.00417.45
8.1.30.0040.00417.66
8.1.20.0070.00017.66
8.1.10.0000.00717.63
8.1.00.0030.00617.59
8.0.300.0000.00718.77
8.0.290.0000.00816.75
8.0.280.0070.00018.41
8.0.270.0040.00416.82
8.0.260.0000.00917.11
8.0.250.0070.00017.07
8.0.240.0070.00016.91
8.0.230.0000.00716.98
8.0.220.0070.00016.82
8.0.210.0000.00716.94
8.0.200.0030.00316.94
8.0.190.0000.00916.88
8.0.180.0020.00516.93
8.0.170.0000.00716.93
8.0.160.0070.00316.94
8.0.150.0000.00716.86
8.0.140.0030.00316.81
8.0.130.0060.00013.30
8.0.120.0070.00016.79
8.0.110.0000.00717.00
8.0.100.0050.00216.92
8.0.90.0000.00816.86
8.0.80.0000.01516.92
8.0.70.0000.00716.80
8.0.60.0050.00216.85
8.0.50.0000.00816.82
8.0.30.0120.00417.01
8.0.20.0120.00717.42
8.0.10.0030.00516.86
8.0.00.0150.00416.55
7.4.330.0060.00015.55
7.4.320.0040.00416.56
7.4.300.0060.00016.63
7.4.290.0050.00316.43
7.4.280.0110.00016.63
7.4.270.0030.00316.52
7.4.260.0030.00616.51
7.4.250.0040.00416.50
7.4.240.0030.00316.52
7.4.230.0000.00716.53
7.4.220.0130.00616.53
7.4.210.0060.01216.48
7.4.200.0070.00016.42
7.4.150.0130.00617.40
7.4.140.0100.00817.86
7.4.130.0090.00816.60
7.4.120.0090.00916.54
7.4.110.0120.00616.67
7.4.100.0150.00916.60
7.4.90.0130.00316.51
7.4.80.0070.01019.39
7.4.70.0150.00916.61
7.4.60.0140.00316.51
7.4.50.0090.00316.46
7.4.40.0090.00616.47
7.4.30.0070.01116.63
7.4.00.0090.00714.94
7.3.330.0080.00013.27
7.3.320.0030.00313.18
7.3.310.0020.00516.14
7.3.300.0000.00716.29
7.3.290.0080.00916.24
7.3.280.0090.01016.24
7.3.270.0150.00417.40
7.3.260.0110.01016.33
7.3.250.0140.00616.35
7.3.240.0120.00616.37
7.3.230.0100.01016.43
7.3.210.0090.00916.54
7.3.200.0060.01519.39
7.3.190.0130.00616.52
7.3.180.0100.01316.14
7.3.170.0210.00016.54
7.3.160.0140.01116.46
7.3.120.0120.00314.81
7.3.110.0100.00714.42
7.3.100.0070.01014.66
7.3.90.0070.00414.69
7.3.80.0110.00414.57
7.3.70.0030.01114.97
7.3.60.0130.00314.83
7.3.50.0040.00814.79
7.3.40.0060.00914.78
7.3.30.0030.00614.75
7.3.20.0120.00316.52
7.3.10.0130.00316.58
7.3.00.0070.00416.58
7.2.330.0070.01816.49
7.2.320.0120.00916.68
7.2.310.0070.01016.57
7.2.300.0170.00716.76
7.2.290.0050.01116.61
7.2.250.0120.00315.08
7.2.240.0160.00314.85
7.2.230.0000.01114.81
7.2.220.0060.00615.29
7.2.210.0130.00315.29
7.2.200.0000.00915.00
7.2.190.0030.00615.09
7.2.180.0080.00415.06
7.2.170.0030.01015.28
7.2.130.0000.01216.53
7.2.120.0040.00817.08
7.2.110.0030.00617.05
7.2.100.0140.00317.00
7.2.90.0130.00017.21
7.2.80.0030.00716.66
7.2.70.0040.01117.00
7.2.60.0040.01116.86
7.2.50.0030.01317.03
7.2.40.0000.00917.01
7.2.30.0060.00617.16
7.2.20.0060.01016.75
7.2.10.0000.01417.14
7.2.00.0050.00918.27
7.1.330.0030.01015.84
7.1.320.0060.01015.85
7.1.310.0030.01015.92
7.1.300.0060.00615.53
7.1.290.0060.00615.72
7.1.280.0040.01115.97
7.1.270.0030.01215.70
7.1.260.0040.00715.81
7.1.250.0000.01315.77
7.1.200.0110.00815.80
7.1.70.0070.00017.16
7.1.60.0040.00717.23
7.1.50.0100.01416.72
7.1.10.0100.09322.08
7.1.00.0100.08722.42
7.0.200.0030.01316.62
7.0.150.0070.06721.80
7.0.140.0100.06021.80
7.0.130.0200.06721.84
7.0.120.0130.05721.85
7.0.110.0130.07721.86
7.0.100.0130.07722.00
7.0.90.0030.07321.87
7.0.80.0130.07321.98
7.0.70.0170.06321.92
7.0.60.0100.06021.63
7.0.50.0170.06022.04
7.0.40.0130.07022.04
7.0.30.0030.06321.92
7.0.20.0100.06021.98
7.0.10.0100.05721.94
7.0.00.0130.05721.89

preferences:
51.81 ms | 401 KiB | 5 Q