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(false); $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.60.0150.00016.63
8.3.50.0080.00717.37
8.3.40.0180.00418.79
8.3.30.0120.00318.57
8.3.20.0040.00418.95
8.3.10.0040.00420.70
8.3.00.0110.00419.38
8.2.180.0140.00716.63
8.2.170.0100.00722.96
8.2.160.0060.00918.79
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0050.00326.16
8.2.120.0030.00719.36
8.2.110.0040.00721.97
8.2.100.0080.00417.84
8.2.90.0040.00419.17
8.2.80.0080.00017.97
8.2.70.0000.00817.63
8.2.60.0030.00517.93
8.2.50.0030.00618.07
8.2.40.0040.00418.06
8.2.30.0000.00718.15
8.2.20.0050.00317.75
8.2.10.0080.00017.84
8.2.00.0020.00517.64
8.1.280.0090.01225.92
8.1.270.0040.00424.66
8.1.260.0050.00326.35
8.1.250.0060.00328.09
8.1.240.0040.00422.19
8.1.230.0040.00817.42
8.1.220.0030.00617.79
8.1.210.0000.00818.77
8.1.200.0000.00917.35
8.1.190.0000.00717.53
8.1.180.0040.00818.10
8.1.170.0020.00518.81
8.1.160.0040.00418.92
8.1.150.0040.00418.68
8.1.140.0070.00417.48
8.1.130.0070.00017.81
8.1.120.0050.00217.43
8.1.110.0000.00817.49
8.1.100.0050.00317.46
8.1.90.0030.00517.47
8.1.80.0040.00417.52
8.1.70.0000.00717.47
8.1.60.0000.00817.67
8.1.50.0050.00317.50
8.1.40.0080.00017.53
8.1.30.0040.00417.67
8.1.20.0030.00517.61
8.1.10.0000.00817.63
8.1.00.0070.00417.61
8.0.300.0070.00018.77
8.0.290.0000.00916.63
8.0.280.0000.00718.48
8.0.270.0030.00317.29
8.0.260.0000.00716.77
8.0.250.0000.00717.00
8.0.240.0030.00616.97
8.0.230.0030.00317.02
8.0.220.0070.00316.90
8.0.210.0030.00316.90
8.0.200.0070.00017.00
8.0.190.0060.00317.06
8.0.180.0060.00316.84
8.0.170.0030.00616.95
8.0.160.0000.00817.00
8.0.150.0040.00416.89
8.0.140.0040.00416.89
8.0.130.0000.00513.42
8.0.120.0040.00416.90
8.0.110.0000.00716.93
8.0.100.0070.00016.71
8.0.90.0040.00416.74
8.0.80.0040.01116.94
8.0.70.0000.00716.92
8.0.60.0000.00816.76
8.0.50.0000.00716.91
8.0.30.0170.00617.34
8.0.20.0090.00917.08
8.0.10.0000.00716.89
8.0.00.0080.01016.73
7.4.330.0020.00213.03
7.4.320.0000.00616.44
7.4.300.0030.00316.52
7.4.290.0040.00416.54
7.4.280.0030.00616.48
7.4.270.0000.00716.55
7.4.260.0030.00313.32
7.4.250.0060.00316.41
7.4.240.0030.00316.54
7.4.230.0000.00716.74
7.4.220.0040.01616.64
7.4.210.0100.00616.62
7.4.200.0070.00016.48
7.4.190.0000.00716.34
7.4.160.0060.00916.42
7.4.150.0120.00616.49
7.4.140.0140.00516.51
7.4.130.0110.00516.49
7.4.120.0080.00816.44
7.4.110.0090.00916.50
7.4.100.0080.00816.68
7.4.90.0120.00616.39
7.4.80.0100.00719.39
7.4.70.0140.00316.68
7.4.60.0100.01016.45
7.4.50.0050.00316.33
7.4.40.0070.00716.33
7.4.30.0080.00816.54
7.4.00.0080.01015.07
7.3.330.0060.00013.29
7.3.320.0050.00013.34
7.3.310.0030.00316.33
7.3.300.0070.00016.39
7.3.290.0030.01316.25
7.3.280.0050.01316.30
7.3.270.0090.00916.46
7.3.260.0130.00316.26
7.3.250.0150.00316.54
7.3.240.0110.01116.30
7.3.230.0070.01016.57
7.3.210.0090.00616.51
7.3.200.0070.01016.26
7.3.190.0030.01316.27
7.3.180.0070.00716.67
7.3.170.0070.01016.51
7.3.160.0170.00016.41
7.3.120.0060.00814.93
7.3.110.0120.00614.85
7.3.100.0000.00914.86
7.3.90.0070.01015.07
7.3.80.0040.01215.02
7.3.70.0030.00814.60
7.3.60.0090.00314.84
7.3.50.0030.00714.85
7.3.40.0070.00714.86
7.3.30.0080.00514.71
7.3.20.0070.00316.68
7.3.10.0080.00516.58
7.3.00.0080.00316.56
7.2.330.0040.01816.58
7.2.320.0130.00616.73
7.2.310.0090.01216.60
7.2.300.0070.01016.55
7.2.290.0070.01116.73
7.2.250.0100.01015.26
7.2.240.0100.01014.77
7.2.230.0110.00715.09
7.2.220.0060.00914.96
7.2.210.0070.01014.86
7.2.200.0080.00415.28
7.2.190.0030.01315.04
7.2.180.0030.01014.93
7.2.170.0060.01214.73
7.2.130.0110.00316.90
7.2.120.0100.00716.93
7.2.110.0060.00616.71
7.2.100.0030.00816.83
7.2.90.0000.01216.78
7.2.80.0060.00816.96
7.2.70.0030.01216.68
7.2.60.0000.01117.12
7.2.50.0000.01416.96
7.2.40.0040.00816.79
7.2.30.0000.01416.82
7.2.20.0080.00516.91
7.2.10.0040.01217.00
7.2.00.0060.00918.17
7.1.330.0030.01415.93
7.1.320.0030.01315.69
7.1.310.0080.00416.00
7.1.300.0350.00715.78
7.1.290.0090.00615.72
7.1.280.0040.01215.74
7.1.270.0000.01715.74
7.1.260.0060.00816.01
7.1.250.0130.00015.54
7.1.240.0000.01015.65
7.1.230.0040.00415.82
7.1.220.0140.00015.79
7.1.210.0000.01415.47
7.1.200.0000.00815.50
7.1.190.0130.00015.71
7.1.180.0080.00515.79
7.1.170.0030.01015.90
7.1.160.0040.01115.93
7.1.150.0000.01215.61
7.1.140.0030.00715.58
7.1.130.0030.01015.97
7.1.120.0060.00315.87
7.1.110.0060.00315.66
7.1.100.0070.00716.87
7.1.90.0090.00615.70
7.1.80.0040.01115.69
7.1.70.0060.00616.48
7.1.60.0080.01017.50
7.1.50.0020.01216.18
7.1.40.0100.00715.84
7.1.30.0060.00315.96
7.1.20.0070.00415.78
7.1.10.0040.01115.79
7.1.00.0050.03619.00
7.0.330.0030.01015.27
7.0.320.0080.00015.15
7.0.310.0140.00015.20
7.0.300.0070.00715.55
7.0.290.0030.00715.07
7.0.280.0040.00415.26
7.0.270.0040.00415.14
7.0.260.0040.01215.55
7.0.250.0050.00515.41
7.0.240.0070.00715.34
7.0.230.0100.00315.48
7.0.220.0110.00415.10
7.0.210.0120.00315.28
7.0.200.0040.00615.99
7.0.190.0030.00815.32
7.0.180.0100.00315.29
7.0.170.0050.00815.54
7.0.160.0030.00715.51
7.0.150.0030.00615.49
7.0.140.0040.04018.81
7.0.130.0030.01315.43
7.0.120.0100.03518.73
7.0.110.0090.00315.42
7.0.100.0030.01015.22
7.0.90.0060.00615.34
7.0.80.0070.00315.25
7.0.70.0000.01115.04
7.0.60.0030.05117.59
7.0.50.0060.04516.64
7.0.40.0100.03616.73
7.0.30.0180.03916.68
7.0.20.0160.02116.68
7.0.10.0010.04816.88
7.0.00.0030.04716.76
5.6.380.0030.00714.17
5.6.370.0070.00714.41
5.6.360.0120.00414.50
5.6.350.0090.00914.29
5.6.340.0110.00314.24
5.6.330.0040.00814.68
5.6.320.0040.00714.60
5.6.310.0040.01114.17
5.6.300.0030.01014.35
5.6.290.0030.00714.62
5.6.280.0030.04017.85
5.6.270.0120.00314.30
5.6.260.0060.00314.45
5.6.250.0090.00014.42
5.6.240.0040.01114.45
5.6.230.0130.00014.36
5.6.220.0100.00314.46
5.6.210.0020.03017.33
5.6.200.0090.03016.15
5.6.190.0050.04317.58
5.6.180.0130.02317.45
5.6.170.0150.04817.32
5.6.160.0060.04217.35
5.6.150.0070.04316.33
5.6.140.0070.03116.40
5.6.130.0030.03616.38
5.6.120.0090.02917.84
5.6.110.0080.02517.74
5.6.100.0070.04717.84
5.6.90.0080.02817.70
5.6.80.0060.03017.44
5.6.70.0030.01414.36
5.6.60.0040.00414.41
5.6.50.0060.00314.48
5.6.40.0000.01114.46
5.6.30.0030.00714.22
5.6.20.0000.01014.22
5.6.10.0030.00914.34
5.6.00.0100.00314.34
5.5.380.0070.00411.37
5.5.370.0110.00011.29
5.5.360.0060.00611.20
5.5.350.1700.02215.71
5.5.340.0050.03214.48
5.5.330.0050.02715.62
5.5.320.0200.03815.70
5.5.310.0170.03815.78
5.5.300.0080.04214.75
5.5.290.0070.04714.60
5.5.280.0090.04415.93
5.5.270.0050.03916.05
5.5.260.0070.04315.98
5.5.250.0030.04215.79
5.5.240.0100.04315.73
5.5.230.0050.00510.98
5.5.220.0060.00611.43
5.5.210.0110.00011.33
5.5.200.0000.00911.33
5.5.190.0030.00611.10
5.5.180.0000.01010.89
5.5.170.0070.00311.35
5.5.160.0030.00311.16
5.5.150.0030.00711.39
5.5.140.0030.00711.24
5.5.130.0040.00411.08
5.5.120.0070.00710.97
5.5.110.0030.00611.33
5.5.100.0000.00611.00
5.5.90.0030.00911.36
5.5.80.0030.00311.22
5.5.70.0000.01110.90
5.5.60.0060.00311.16
5.5.50.0000.01011.23
5.5.40.0070.00311.13
5.5.30.0040.00411.04
5.5.20.0040.00811.04
5.5.10.0030.00311.45
5.5.00.0060.00611.35
5.4.450.1620.02515.17
5.4.440.1430.02315.30
5.4.430.1650.02115.27
5.4.420.1570.01815.23
5.4.410.1600.02515.29
5.4.400.0040.02515.05
5.4.390.1580.02415.15
5.4.380.1790.02015.15
5.4.370.1810.02515.16
5.4.360.1720.02315.04
5.4.350.0330.02615.19
5.4.340.1660.01915.18
5.4.330.0030.00611.39
5.4.320.0050.04014.96
5.4.310.1470.02414.96
5.4.300.1510.01615.08
5.4.290.1570.02015.01
5.4.280.0050.02015.07
5.4.270.0700.02515.24
5.4.260.1600.02115.03
5.4.250.0050.02015.05
5.4.240.0650.02115.10
5.4.230.0900.02015.07
5.4.220.1300.02515.17
5.4.210.1170.01815.17
5.4.200.1540.02015.29
5.4.190.2030.02015.09
5.4.180.1470.02115.12
5.4.170.1700.01815.01
5.4.160.1640.01815.17
5.4.150.1860.02015.00
5.4.140.1680.02013.64
5.4.130.1500.01713.81
5.4.120.1320.02413.63
5.4.110.1530.02013.89
5.4.100.1730.02513.74
5.4.90.1580.01813.76
5.4.80.1800.02213.69
5.4.70.1750.01913.79
5.4.60.1660.02113.61
5.4.50.0050.02313.84
5.4.40.1660.02013.80
5.4.30.1670.01813.95
5.4.20.1710.01813.58
5.4.10.0120.03813.79
5.4.00.0120.03113.38
5.3.290.0930.03012.68
5.3.280.1230.02012.70
5.3.270.1690.01812.62
5.3.260.1520.02512.69
5.3.250.1830.02312.62
5.3.240.1300.02012.54
5.3.230.1590.01512.69
5.3.220.1480.01712.61
5.3.210.1650.02512.52
5.3.200.1480.02412.54
5.3.190.1550.02412.64
5.3.180.1710.01712.62
5.3.170.1810.02812.49
5.3.160.1020.02912.70
5.3.150.0020.03212.62
5.3.140.0920.02212.57
5.3.130.1550.02012.40
5.3.120.1570.02112.44
5.3.110.1110.01912.64
5.3.100.1350.02612.21
5.3.90.1580.02012.35
5.3.80.1520.02812.15
5.3.70.1550.02212.33
5.3.60.1550.01812.31
5.3.50.1620.02412.21
5.3.40.1570.02112.29
5.3.30.1650.02112.34
5.3.20.1630.02212.08
5.3.10.0040.02211.91
5.3.00.1330.02312.10
5.2.170.1460.01810.35
5.2.160.1300.01710.29
5.2.150.1300.01810.23
5.2.140.1420.01810.55
5.2.130.1320.01510.43
5.2.120.0260.02310.31
5.2.110.0060.03010.33
5.2.100.1410.02110.30
5.2.90.1220.01910.46
5.2.80.1400.01910.34
5.2.70.1300.01810.21
5.2.60.1330.01810.14
5.2.50.1360.01310.11
5.2.40.0990.01310.13
5.2.30.1370.01810.29
5.2.20.1290.01510.17
5.2.10.1060.01810.06
5.2.00.0240.01510.02
5.1.60.0030.0179.27
5.1.50.0030.0179.40
5.1.40.0430.0199.35
5.1.30.1020.0159.56
5.1.20.1020.0169.62
5.1.10.0950.0219.24
5.1.00.1040.0149.21
5.0.50.0550.0118.45
5.0.40.0580.0158.36
5.0.30.0520.0178.34
5.0.20.0570.0128.23
5.0.10.0570.0128.33
5.0.00.0310.0238.26
4.4.90.0520.0107.97
4.4.80.0500.0107.97
4.4.70.0550.0117.97
4.4.60.0500.0127.97
4.4.50.0540.0087.97
4.4.40.0020.0177.97
4.4.30.0040.0087.97
4.4.20.0600.0117.97
4.4.10.0530.0107.98
4.4.00.0470.0137.98
4.3.110.0560.0167.99
4.3.100.0430.0107.99
4.3.90.0580.0118.00
4.3.80.0030.0238.00
4.3.70.0020.0118.00
4.3.60.0030.0158.00
4.3.50.0020.0128.00
4.3.40.0020.0158.00
4.3.30.0020.0098.01
4.3.20.0020.0178.01
4.3.10.0010.0208.01
4.3.00.0020.0138.01

preferences:
51.25 ms | 400 KiB | 5 Q