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->setActive(false); $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.0070.01316.75
8.3.50.0130.00816.53
8.3.40.0000.01518.60
8.3.30.0030.01218.70
8.3.20.0080.00018.74
8.3.10.0090.00920.50
8.3.00.0100.00717.38
8.2.180.0120.00616.50
8.2.170.0110.00422.96
8.2.160.0100.00320.53
8.2.150.0040.00424.18
8.2.140.0090.00624.66
8.2.130.0150.00026.16
8.2.120.0050.00319.95
8.2.110.0030.00620.92
8.2.100.0080.00317.84
8.2.90.0050.00319.34
8.2.80.0080.00017.97
8.2.70.0040.00417.63
8.2.60.0030.00617.88
8.2.50.0040.00418.07
8.2.40.0000.00718.34
8.2.30.0000.00718.15
8.2.20.0030.00617.73
8.2.10.0040.00419.57
8.2.00.0040.00417.76
8.1.280.0070.00725.92
8.1.270.0000.00924.66
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0060.00321.30
8.1.230.0070.00417.52
8.1.220.0060.00317.74
8.1.210.0040.00418.77
8.1.200.0000.01017.34
8.1.190.0000.00817.35
8.1.180.0050.00318.10
8.1.170.0030.00618.77
8.1.160.0040.00418.79
8.1.150.0050.00218.64
8.1.140.0050.00317.44
8.1.130.0070.00017.90
8.1.120.0020.00517.38
8.1.110.0070.00017.38
8.1.100.0040.00417.41
8.1.90.0040.00417.48
8.1.80.0050.00317.48
8.1.70.0030.00317.46
8.1.60.0060.00317.61
8.1.50.0000.00817.56
8.1.40.0000.00817.57
8.1.30.0080.00017.71
8.1.20.0040.00417.63
8.1.10.0060.00317.63
8.1.00.0030.00617.58
8.0.300.0040.00418.77
8.0.290.0030.00616.63
8.0.280.0000.00718.35
8.0.270.0030.00317.24
8.0.260.0000.00716.80
8.0.250.0000.00816.97
8.0.240.0070.00416.85
8.0.230.0070.00016.96
8.0.220.0050.00217.00
8.0.210.0030.00316.94
8.0.200.0070.00016.86
8.0.190.0040.00416.94
8.0.180.0050.00216.82
8.0.170.0030.00616.97
8.0.160.0000.00716.89
8.0.150.0030.00616.83
8.0.140.0080.00016.77
8.0.130.0000.00813.33
8.0.120.0000.00916.83
8.0.110.0070.00016.82
8.0.100.0030.00516.75
8.0.90.0070.00016.69
8.0.80.0100.00616.93
8.0.70.0040.00416.95
8.0.60.0040.00416.95
8.0.50.0000.00716.80
8.0.30.0120.00717.26
8.0.20.0130.00617.15
8.0.10.0030.00516.95
8.0.00.0120.00616.71
7.4.330.0050.00012.98
7.4.320.0000.00616.50
7.4.300.0030.00316.62
7.4.290.0030.00316.52
7.4.280.0030.00616.54
7.4.270.0060.00316.67
7.4.260.0000.00613.23
7.4.250.0040.00416.62
7.4.240.0040.00416.52
7.4.230.0030.00316.70
7.4.220.0060.01216.67
7.4.210.0060.01116.52
7.4.200.0000.00716.69
7.4.190.0070.00016.66
7.4.160.0160.00316.59
7.4.150.0100.00716.37
7.4.140.0090.01216.53
7.4.130.0120.00816.63
7.4.120.0050.01316.47
7.4.110.0130.00616.46
7.4.100.0030.01316.41
7.4.90.0190.00016.55
7.4.80.0070.01016.52
7.4.70.0030.01416.38
7.4.60.0040.01416.46
7.4.50.0060.00316.66
7.4.40.0070.00716.44
7.4.30.0120.00316.39
7.4.00.0030.00814.93
7.3.330.0000.00613.25
7.3.320.0000.00613.40
7.3.310.0070.00016.18
7.3.300.0000.00716.20
7.3.290.0000.00916.32
7.3.280.0070.01016.30
7.3.270.0090.01016.51
7.3.260.0100.01116.59
7.3.250.0120.00616.64
7.3.240.0130.00516.52
7.3.230.0090.00916.48
7.3.210.0080.00816.46
7.3.200.0110.00619.39
7.3.190.0100.01016.34
7.3.180.0030.01316.25
7.3.170.0130.00316.64
7.3.160.0130.00316.40
7.3.120.0040.01114.74
7.2.330.0090.00916.52
7.2.320.0140.00316.59
7.2.310.0030.01616.56
7.2.300.0130.00316.80
7.2.290.0080.00816.59
7.2.60.0040.01116.77
7.2.00.0090.00419.57
7.1.200.0000.01215.70
7.1.100.0030.00518.09
7.1.70.0060.01017.31
7.1.60.0100.01419.40
7.1.50.0060.01816.75
7.1.00.0030.07022.45
7.0.200.0040.00416.69
7.0.140.0030.07722.00
7.0.120.0070.07021.96
7.0.110.0000.08022.03
7.0.100.0070.07022.02
7.0.90.0000.07322.21
7.0.80.0030.03022.06
7.0.70.0070.02721.98
7.0.60.0070.03022.02
7.0.50.0000.03322.13
7.0.40.0000.03322.04
7.0.30.0000.03321.98
7.0.20.0070.02722.02
7.0.10.0000.03322.20
7.0.00.0070.02721.98
5.6.280.0000.07721.12
5.6.260.0070.07021.12
5.6.250.0070.06721.10
5.6.240.0030.06721.06
5.6.230.0030.03321.10
5.6.220.0070.03021.08
5.6.210.0030.03020.97
5.6.200.0070.03020.99
5.6.190.0000.03720.84
5.6.180.0000.03321.04
5.6.170.0000.03320.87
5.6.160.0000.03321.04
5.6.150.0070.03021.02
5.6.140.0030.05020.86
5.6.130.0000.03321.07
5.6.120.0030.03321.09
5.6.110.0000.03720.95
5.6.100.0030.03320.75
5.6.90.0000.03321.02
5.6.80.0000.03320.13
5.6.70.0000.03320.23
5.6.60.0000.03320.43
5.6.50.0070.02720.20
5.6.40.0000.03320.18
5.6.30.0000.03320.23
5.6.20.0030.03020.32
5.6.10.0070.02720.29
5.6.00.0070.02720.37
5.5.380.0030.04317.52
5.5.370.0030.03017.70
5.5.360.0000.03317.47
5.5.350.0000.03317.68
5.5.340.0000.03318.09
5.5.330.0000.03317.93
5.5.320.0030.03018.09
5.5.310.0030.03018.09
5.5.300.0030.03717.95
5.5.290.0000.03318.13
5.5.280.0000.03318.10
5.5.270.0070.03018.24
5.5.260.0000.03317.91
5.5.250.0030.03018.04
5.5.240.0000.03017.48
5.5.230.0000.03317.21
5.5.220.0000.03017.48
5.5.210.0000.03017.34
5.5.200.0000.03017.29
5.5.190.0000.03317.60
5.5.180.0030.03017.58
5.5.160.0000.03017.28
5.5.150.0000.03017.44
5.5.140.0000.03017.30
5.5.130.0000.03017.42
5.5.120.0000.03017.57
5.5.110.0000.03017.27
5.5.100.0030.03017.36
5.5.90.0000.03017.34
5.5.80.0030.02717.47
5.5.70.0000.03317.16
5.5.60.0000.03017.33
5.5.50.0030.02717.20
5.5.40.0030.02717.33
5.5.30.0070.02317.31
5.5.20.0030.03017.15
5.5.10.0030.03017.31
5.5.00.0070.02717.30
5.4.450.0030.03719.32
5.4.440.0000.03319.33
5.4.430.0030.03019.63
5.4.420.0030.03019.65
5.4.410.0070.02719.29
5.4.400.0030.02718.97
5.4.390.0000.03319.18
5.4.380.0030.02718.98
5.4.370.0000.03019.22
5.4.360.0000.03318.98
5.4.350.0000.03019.30
5.4.340.0000.03319.16
5.4.320.0000.03319.14
5.4.310.0000.03018.96
5.4.300.0000.03019.15
5.4.290.0000.03019.17
5.4.280.0000.03319.21
5.4.270.0000.03019.00
5.4.260.0000.03018.96
5.4.250.0000.03018.99
5.4.240.0000.03019.29
5.4.230.0030.02718.95
5.4.220.0000.03319.02
5.4.210.0000.03018.93
5.4.200.0000.03019.17
5.4.190.0030.02719.29
5.4.180.0000.03019.21
5.4.170.0000.03019.14
5.4.160.0030.02718.99
5.4.150.0000.03319.06
5.4.140.0000.03016.58
5.4.130.0000.03016.44
5.4.120.0030.02716.39
5.4.110.0030.02716.61
5.4.100.0000.03016.46
5.4.90.0030.02716.46
5.4.80.0000.03716.49
5.4.70.0030.02716.53
5.4.60.0000.03016.50
5.4.50.0000.03016.46
5.4.40.0000.03016.44
5.4.30.0000.03016.51
5.4.20.0030.02716.47
5.4.10.0000.03016.54
5.4.00.0000.03015.96
5.3.290.0030.03014.70
5.3.280.0000.03014.75
5.3.270.0030.03014.64
5.3.260.0000.03014.65
5.3.250.0000.03014.73
5.3.240.0000.03014.86
5.3.230.0000.03014.75
5.3.220.0030.02714.68
5.3.210.0070.02714.82
5.3.200.0000.03014.63
5.3.190.0000.03014.73
5.3.180.0030.02714.58
5.3.170.0000.03014.69
5.3.160.0000.03014.71
5.3.150.0000.03014.81
5.3.140.0000.03014.59
5.3.130.0030.03014.56
5.3.120.0000.03014.60
5.3.110.0030.02714.55
5.3.100.0030.02714.19
5.3.90.0000.03014.18
5.3.80.0030.02714.04
5.3.70.0070.02314.03
5.3.60.0030.02714.09
5.3.50.0000.02714.00
5.3.40.0030.02714.00
5.3.30.0000.03013.93
5.3.20.0000.02713.94
5.3.10.0000.02713.76
5.3.00.0000.03013.74
5.2.170.0030.02011.25
5.2.160.0030.02011.17
5.2.150.0030.02011.14
5.2.140.0000.02311.18
5.2.130.0000.02310.98
5.2.120.0000.02311.10
5.2.110.0030.02011.14
5.2.100.0000.02311.21
5.2.90.0000.02311.22
5.2.80.0000.02311.26
5.2.70.0000.02311.09
5.2.60.0000.02311.05
5.2.50.0000.02311.04
5.2.40.0000.02310.99
5.2.30.0000.02311.00
5.2.20.0000.02310.98
5.2.10.0070.01710.89
5.2.00.0000.02310.82
5.1.60.0000.02010.28
5.1.50.0000.02010.28
5.1.40.0000.02010.28
5.1.30.0000.02010.38
5.1.20.0000.02010.28
5.1.10.0030.01710.28
5.1.00.0000.02010.28
5.0.50.0000.01710.28
5.0.40.0000.01710.28
5.0.30.0000.02310.28
5.0.20.0000.01710.28
5.0.10.0000.01710.28
5.0.00.0000.02310.28
4.4.90.0000.01310.28
4.4.80.0000.01310.28
4.4.70.0030.01010.28
4.4.60.0030.01010.28
4.4.50.0000.01310.28
4.4.40.0000.02010.28
4.4.30.0030.01010.28
4.4.20.0000.01310.28
4.4.10.0000.01310.28
4.4.00.0000.02010.28
4.3.110.0000.01310.28
4.3.100.0000.01010.28
4.3.90.0000.01010.28
4.3.80.0000.02010.28
4.3.70.0000.01010.28
4.3.60.0000.01010.28
4.3.50.0030.01010.28
4.3.40.0000.02010.28
4.3.30.0000.01310.28
4.3.20.0000.01310.28
4.3.10.0000.01310.28
4.3.00.0030.01010.28

preferences:
47.21 ms | 401 KiB | 5 Q