3v4l.org

run code in 300+ PHP versions simultaneously
<?php # BitwiseFlag.php abstract class BitwiseFlag { protected $flags; /* * Note: these functions are protected to prevent outside code * from falsely setting BITS. See how the extending class 'User' * handles this. * */ protected function isFlagSet($flag) { return (($this->flags & $flag) == $flag); } protected function setFlag($flag, $value) { if($value) { $this->flags |= $flag; } else { $this->flags &= ~$flag; } } } class User extends BitwiseFlag { const FLAG_REGISTERED = 1; // BIT #1 of $flags has the value 1 const FLAG_ACTIVE = 2; // BIT #2 of $flags has the value 2 const FLAG_MEMBER = 4; // BIT #3 of $flags has the value 4 const FLAG_ADMIN = 8; // BIT #4 of $flags has the value 8 public function isRegistered(){ return $this->isFlagSet(self::FLAG_REGISTERED); } public function isActive(){ return $this->isFlagSet(self::FLAG_ACTIVE); } public function isMember(){ return $this->isFlagSet(self::FLAG_MEMBER); } public function isAdmin(){ return $this->isFlagSet(self::FLAG_ADMIN); } public function setRegistered($value){ $this->setFlag(self::FLAG_REGISTERED, $value); } public function setActive($value){ $this->setFlag(self::FLAG_ACTIVE, $value); } public function setMember($value){ $this->setFlag(self::FLAG_MEMBER, $value); } public function setAdmin($value){ $this->setFlag(self::FLAG_ADMIN, $value); } public function __toString(){ return 'User [' . ($this->isRegistered() ? 'REGISTERED' : '') . ($this->isActive() ? ' ACTIVE' : '') . ($this->isMember() ? ' MEMBER' : '') . ($this->isAdmin() ? ' ADMIN' : '') . ']'; } } $user = new User(); $user->setRegistered(true); $user->setActive(true); $user->setMember(true); $user->setAdmin(true); echo $user; // outputs: User [REGISTERED ACTIVE MEMBER ADMIN]

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.0160.00618.43
8.3.60.0100.01018.20
8.3.50.0210.00721.94
8.3.40.0090.00918.79
8.3.30.0030.01019.08
8.3.20.0000.00720.39
8.3.10.0060.00323.65
8.3.00.0090.00020.80
8.2.180.0060.01216.50
8.2.170.0160.00022.96
8.2.160.0070.00720.35
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0050.00326.16
8.2.120.0030.00519.48
8.2.110.0000.00922.27
8.2.100.0040.00817.72
8.2.90.0050.00319.15
8.2.80.0030.00617.97
8.2.70.0080.00017.63
8.2.60.0060.00318.05
8.2.50.0040.00418.07
8.2.40.0040.00419.76
8.2.30.0040.00418.39
8.2.20.0040.00417.66
8.2.10.0040.00418.16
8.2.00.0040.00417.68
8.1.280.0070.00725.92
8.1.270.0000.00823.82
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0090.00023.78
8.1.230.0070.00419.08
8.1.220.0000.00817.78
8.1.210.0030.00618.77
8.1.200.0000.00917.47
8.1.190.0060.00317.35
8.1.180.0040.00418.10
8.1.170.0000.00818.56
8.1.160.0030.00522.04
8.1.150.0040.00418.60
8.1.140.0000.00717.52
8.1.130.0030.00317.95
8.1.120.0040.00417.43
8.1.110.0040.00417.35
8.1.100.0000.00817.38
8.1.90.0070.00017.45
8.1.80.0050.00317.38
8.1.70.0000.00717.48
8.1.60.0040.00417.55
8.1.50.0000.00817.61
8.1.40.0050.00517.54
8.1.30.0060.00317.70
8.1.20.0000.00717.65
8.1.10.0000.00817.50
8.1.00.0040.00417.54
8.0.300.0000.00818.77
8.0.290.0000.00816.63
8.0.280.0070.00018.39
8.0.270.0000.01117.20
8.0.260.0030.00317.20
8.0.250.0000.00717.00
8.0.240.0030.00317.00
8.0.230.0000.00716.84
8.0.220.0000.00716.83
8.0.210.0040.00416.90
8.0.200.0030.00316.95
8.0.190.0000.00716.97
8.0.180.0040.00416.82
8.0.170.0040.00416.97
8.0.160.0070.00016.83
8.0.150.0000.00916.77
8.0.140.0070.00016.78
8.0.130.0050.00013.41
8.0.120.0060.00316.95
8.0.110.0050.00316.93
8.0.100.0000.00716.70
8.0.90.0040.00416.72
8.0.80.0030.01316.82
8.0.70.0000.00816.79
8.0.60.0040.00416.91
8.0.50.0040.00416.83
8.0.30.0120.00917.33
8.0.20.0130.00717.40
8.0.10.0000.00716.98
8.0.00.0160.00216.79
7.4.330.0050.00015.13
7.4.320.0030.00316.61
7.4.300.0030.00316.54
7.4.290.0070.00016.55
7.4.280.0050.00516.38
7.4.270.0080.00016.52
7.4.260.0040.00416.66
7.4.250.0040.00416.57
7.4.240.0030.00516.59
7.4.230.0030.00316.45
7.4.220.0070.01116.66
7.4.210.0040.01516.71
7.4.200.0000.00716.70
7.4.160.0090.00616.43
7.4.150.0110.00717.40
7.4.140.0080.00817.86
7.4.130.0080.00816.56
7.4.120.0070.01316.59
7.4.110.0030.01316.71
7.4.100.0090.01416.59
7.4.90.0130.00316.32
7.4.80.0100.01319.39
7.4.70.0090.00916.50
7.4.60.0030.01316.52
7.4.50.0030.00616.42
7.4.40.0100.00716.38
7.4.30.0100.00616.61
7.4.00.0070.00714.57
7.3.330.0030.00413.33
7.3.320.0030.00313.34
7.3.310.0070.00016.23
7.3.300.0050.00216.20
7.3.290.0030.01016.34
7.3.280.0070.01116.32
7.3.270.0180.00317.40
7.3.260.0110.00616.52
7.3.250.0030.01416.41
7.3.240.0030.01316.40
7.3.230.0040.01216.59
7.3.210.0080.01116.66
7.3.200.0150.00619.39
7.3.190.0170.00016.53
7.3.180.0110.00416.31
7.3.170.0080.00816.56
7.3.160.0060.00916.39
7.3.120.0140.00315.00
7.3.110.0100.00714.82
7.3.100.0040.01114.73
7.3.90.0070.00314.96
7.3.80.0060.00615.13
7.3.70.0070.01014.73
7.3.60.0100.00314.81
7.3.50.0080.00014.89
7.3.40.0060.00614.81
7.3.30.0080.00814.87
7.3.20.0000.00916.66
7.3.10.0100.00516.59
7.3.00.0030.00816.61
7.2.330.0100.00716.65
7.2.320.0140.00316.76
7.2.310.0110.01116.54
7.2.300.0090.00916.82
7.2.290.0090.00916.51
7.2.240.0030.01015.25
7.2.230.0070.00715.05
7.2.220.0030.00615.34
7.2.210.0070.01015.21
7.2.200.0000.01114.79
7.2.190.0040.01215.06
7.2.180.0090.00314.96
7.2.170.0070.01014.87
7.2.160.0060.00615.15
7.2.150.0030.01217.14
7.2.140.0030.00916.98
7.2.130.0110.00716.91
7.2.120.0090.00516.84
7.2.110.0040.01117.10
7.2.100.0030.01217.01
7.2.90.0050.00816.88
7.2.80.0050.00616.67
7.2.70.0070.00617.02
7.2.60.0080.00516.92
7.2.50.0020.01216.67
7.2.40.0080.00816.94
7.2.30.0050.00717.01
7.2.20.0050.01016.81
7.2.10.0030.00817.04
7.2.00.0090.00217.74
7.1.330.0060.01015.93
7.1.320.0100.00315.84
7.1.310.0060.00916.06
7.1.300.0060.00915.71
7.1.290.0070.00315.92
7.1.280.0050.00315.77
7.1.270.0020.00515.78
7.1.260.0070.00415.87
7.1.250.0020.01115.78
7.1.240.0000.01315.46
7.1.230.0070.00715.91
7.1.220.0030.00615.74
7.1.210.0040.01015.89
7.1.200.0100.00715.68
7.1.190.0060.01015.64
7.1.180.0040.00715.73
7.1.170.0030.01315.69
7.1.160.0030.01015.89
7.1.150.0030.01016.00
7.1.140.0030.01015.83
7.1.130.0040.00715.76
7.1.120.0070.00716.00
7.1.110.0060.00315.74
7.1.100.0030.01017.00
7.1.90.0040.00416.03
7.1.80.0000.00915.83
7.1.70.0040.00616.56
7.1.60.0050.00516.56
7.1.50.0100.00516.34
7.1.40.0030.01015.87
7.1.30.0090.00315.84
7.1.20.0120.00015.98
7.1.10.0030.00715.77
7.1.00.0000.04619.04
7.0.330.0030.00815.29
7.0.320.0060.00615.30
7.0.310.0000.01615.37
7.0.300.0080.00015.38
7.0.290.0050.00315.18
7.0.280.0030.01015.35
7.0.270.0120.00015.17
7.0.260.0030.01015.20
7.0.250.0030.01015.21
7.0.240.0090.00315.12
7.0.230.0070.00715.38
7.0.220.0030.00915.34
7.0.210.0060.00915.14
7.0.200.0020.00816.02
7.0.190.0070.00315.45
7.0.180.0100.00315.30
7.0.170.0130.00015.29
7.0.160.0090.00315.40
7.0.150.0070.00715.49
7.0.140.0030.03818.71
7.0.130.0030.01015.47
7.0.120.0030.01015.59
7.0.110.0080.00415.30
7.0.100.0090.03817.79
7.0.90.0120.04217.72
7.0.80.0120.02017.80
7.0.70.0030.04717.66
7.0.60.0020.04317.78
7.0.50.0070.04717.93
7.0.40.0050.02816.83
7.0.30.0070.04716.73
7.0.20.0080.04216.80
7.0.10.0120.03916.76
7.0.00.0080.04316.73
5.6.380.0040.01114.46
5.6.370.0070.01014.49
5.6.360.0090.00014.68
5.6.350.0000.01214.26
5.6.340.0000.00914.54
5.6.330.0060.00614.25
5.6.320.0030.00914.35
5.6.310.0060.00314.00
5.6.300.0080.00314.60
5.6.290.0100.00314.53
5.6.280.0020.04417.75
5.6.270.0000.00814.43
5.6.260.0000.01614.36
5.6.250.0090.04417.73
5.6.240.0070.04917.48
5.6.230.0030.04517.56
5.6.220.0030.03117.54
5.6.210.0080.02217.69
5.6.200.0080.04217.71
5.6.190.0050.04817.68
5.6.180.0130.03617.82
5.6.170.0030.04717.76
5.6.160.0060.04017.71
5.6.150.0110.02117.81
5.6.140.0090.02317.66
5.6.130.0100.04717.63
5.6.120.0100.04517.73
5.6.110.0100.04317.95
5.6.100.0090.04717.85
5.6.90.0030.03017.76
5.6.80.0070.04217.23
5.6.70.0030.04517.40
5.6.60.0070.02717.26
5.6.50.0100.02517.38
5.6.40.0050.03117.34
5.6.30.0090.04617.30
5.6.20.0050.02917.38
5.6.10.0030.03917.28
5.6.00.0090.04317.38
5.5.380.0050.04115.85
5.5.370.0090.03615.72
5.5.360.0070.03015.76
5.5.350.0080.04015.87
5.5.340.0080.02215.86
5.5.330.0100.04016.03
5.5.320.0050.02316.01
5.5.310.0070.03416.13
5.5.300.0060.04316.01
5.5.290.0050.03915.96
5.5.280.0070.03216.15
5.5.270.0090.04015.97
5.5.260.0040.04915.92
5.5.250.0050.04615.85
5.5.240.0070.04115.53
5.5.230.0080.04115.65
5.5.220.0080.04215.70
5.5.210.0100.04015.76
5.5.200.0130.03515.65
5.5.190.0030.03915.66
5.5.180.0020.04015.70
5.5.170.0070.00310.97
5.5.160.0070.03815.68
5.5.150.0050.04015.64
5.5.140.0010.04515.62
5.5.130.0080.03815.53
5.5.120.0030.03315.73
5.5.110.0090.03815.69
5.5.100.0070.04415.62
5.5.90.0070.02115.70
5.5.80.0070.04015.54
5.5.70.0080.04015.64
5.5.60.0030.02515.60
5.5.50.0080.04015.69
5.5.40.0110.03115.66
5.5.30.0060.04015.60
5.5.20.0080.03815.52
5.5.10.0110.03315.62
5.5.00.0100.04315.54
5.4.450.0030.04415.28
5.4.440.0070.02515.24
5.4.430.0070.04215.18
5.4.420.0050.03615.44
5.4.410.0080.03615.03
5.4.400.0070.04114.97
5.4.390.0050.04415.20
5.4.380.0020.02915.21
5.4.370.0030.04415.18
5.4.360.0080.04215.01
5.4.350.0030.02515.04
5.4.340.0070.02715.25
5.4.330.0030.00911.15
5.4.320.0070.04215.16
5.4.310.0080.02315.26
5.4.300.0000.03615.14
5.4.290.0070.02315.14
5.4.280.0110.04014.83
5.4.270.0080.02815.15
5.4.260.0050.03615.12
5.4.250.0060.02415.12
5.4.240.0130.03614.97
5.4.230.0090.03214.99
5.4.220.0030.02215.22
5.4.210.0110.03114.98
5.4.200.0070.03015.08
5.4.190.0140.03515.21
5.4.180.0030.02515.07
5.4.170.0080.04215.23
5.4.160.0020.03714.96
5.4.150.0070.04115.16
5.4.140.0050.04213.81
5.4.130.0050.03813.84
5.4.120.0030.04013.91
5.4.110.0030.04013.66
5.4.100.0030.02813.67
5.4.90.0070.03813.85
5.4.80.0080.03313.77
5.4.70.0030.03513.80
5.4.60.0060.02213.73
5.4.50.0050.03013.61
5.4.40.0050.02813.68
5.4.30.0050.02313.79
5.4.20.0040.02313.74
5.4.10.0080.01913.63
5.4.00.0100.03713.43
5.3.290.0080.03612.76
5.3.280.0050.02412.73
5.3.270.0110.04012.65
5.3.260.0030.02512.70
5.3.250.0030.03912.66
5.3.240.0070.04212.64
5.3.230.0030.02712.65
5.3.220.0080.03212.68
5.3.210.0020.04512.66
5.3.200.0050.02512.64
5.3.190.0050.04312.65
5.3.180.0050.02612.61
5.3.170.0070.04112.64
5.3.160.0070.04212.67
5.3.150.0070.02012.65
5.3.140.0060.03812.63
5.3.130.0060.02412.60
5.3.120.0070.02912.60
5.3.110.0080.03712.63
5.3.100.0060.03312.36
5.3.90.0070.02012.35
5.3.80.0030.02112.40
5.3.70.0060.02412.41
5.3.60.0170.03212.35
5.3.50.0020.04112.30
5.3.40.0020.04612.39
5.3.30.0070.03712.28
5.3.20.0060.03512.27
5.3.10.0000.03912.16
5.3.00.0030.03912.24
5.2.170.0030.02211.00
5.2.160.0040.03610.99
5.2.150.0060.03310.99
5.2.140.0020.03510.90
5.2.130.0050.02010.97
5.2.120.0050.02710.86
5.2.110.0030.03510.87
5.2.100.0070.03210.94
5.2.90.0030.02710.86
5.2.80.0030.02010.85
5.2.70.0030.02010.93
5.2.60.0070.03010.95
5.2.50.0050.02510.89
5.2.40.0030.03310.82
5.2.30.0030.03910.82
5.2.20.0020.03410.88
5.2.10.0020.02810.72
5.2.00.0030.03210.77
5.1.60.0050.02710.58
5.1.50.0000.02910.58
5.1.40.0020.02910.58
5.1.30.0000.03410.58
5.1.20.0050.03110.58
5.1.10.0030.03010.58
5.1.00.0020.01810.58
5.0.50.0060.02210.58
5.0.40.0020.02710.58
5.0.30.0030.01710.58
5.0.20.0080.01810.58
5.0.10.0030.01710.58
5.0.00.0070.03210.58
4.4.90.0050.01810.58
4.4.80.0020.01010.58
4.4.70.0020.01210.58
4.4.60.0020.01010.58
4.4.50.0050.01510.58
4.4.40.0030.02810.58
4.4.30.0020.02010.58
4.4.20.0030.01810.58
4.4.10.0000.02010.58
4.4.00.0030.02810.58
4.3.110.0000.02010.58
4.3.100.0020.01310.58
4.3.90.0000.02110.58
4.3.80.0030.02810.58
4.3.70.0010.02010.58
4.3.60.0030.01810.58
4.3.50.0000.02010.58
4.3.40.0040.02210.58
4.3.30.0020.02010.58
4.3.20.0020.01610.58
4.3.10.0030.01710.58
4.3.00.0030.01810.58

preferences:
46.19 ms | 401 KiB | 5 Q