3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Verifies that a password matches a hash. This validator requires that * function password_verify() is available (it is implemented natively * since PHP 5.5.0). */ class Zefram_Validate_PasswordVerify extends Zend_Validate_Abstract { const EMPTY_HASH = 'passwordVerifyEmptyHash'; const INVALID = 'passwordVerifyInvalid'; /** * @var string */ protected $_hash; protected $_messageTemplates = array( self::EMPTY_HASH => 'No hash was provided to match against', self::INVALID => 'The password provided is invalid', ); /** * Constructor. * * @param string|array $options * @throws Zend_Validate_Exception */ public function __construct($options = null) { if (!function_exists('password_verify')) { throw new Zend_Validate_Exception('Function password_verify() is not callable. Please upgrade to PHP 5.5 or install userland implementation. Read more at http://php.net/manual/en/function.password-verify.php'); } if (is_string($options)) { $options = array('hash' => $options); } if (is_object($options) && method_exists($options, 'toArray')) { $options = $options->toArray(); } if ($options) { $this->setOptions((array) $options); } } /** * @param array $options * @return Zefram_Validate_PasswordVerify */ public function setOptions(array $options) { foreach ($options as $key => $value) { $method = 'set' . $key; if (method_exists($this, $method)) { $this->{$method}($value); } } return $this; } /** * @param string $hash * @return Zefram_Validate_PasswordVerify */ public function setHash($hash) { $this->_hash = (string) $hash; return $this; } /** * @return string */ public function getHash() { return $this->_hash; } /** * @param string $value * @return bool */ public function isValid($value) { $value = (string) $value; $this->_setValue($value); $hash = $this->getHash(); if (empty($hash)) { $this->_error(self::EMPTY_HASH); return false; } if (!password_verify($value, $hash)) { $this->_error(self::INVALID); return false; } return true; } }

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.0110.00418.55
8.3.50.0210.00822.12
8.3.40.0070.00718.88
8.3.30.0110.00319.09
8.3.20.0070.00020.13
8.3.10.0040.00423.66
8.3.00.0040.00420.95
8.2.180.0160.00616.88
8.2.170.0120.00322.96
8.2.160.0070.00720.57
8.2.150.0040.00424.18
8.2.140.0030.00524.66
8.2.130.0090.00926.16
8.2.120.0090.00019.00
8.2.110.0030.00622.13
8.2.100.0110.00320.58
8.2.90.0040.00419.22
8.2.80.0000.00817.97
8.2.70.0030.00617.63
8.2.60.0030.00617.93
8.2.50.0030.00618.07
8.2.40.0040.00419.97
8.2.30.0000.00718.25
8.2.20.0000.00817.76
8.2.10.0030.00518.02
8.2.00.0040.00417.79
8.1.280.0120.00325.92
8.1.270.0060.00322.07
8.1.260.0040.00426.35
8.1.250.0000.00728.09
8.1.240.0040.00422.19
8.1.230.0040.00819.05
8.1.220.0030.00517.74
8.1.210.0040.00418.77
8.1.200.0030.00617.22
8.1.190.0090.00017.10
8.1.180.0000.01018.10
8.1.170.0060.00318.34
8.1.160.0070.00021.96
8.1.150.0040.00418.50
8.1.140.0040.00417.36
8.1.130.0000.00717.78
8.1.120.0040.00417.48
8.1.110.0040.00417.42
8.1.100.0000.00817.44
8.1.90.0040.00417.33
8.1.80.0030.00517.31
8.1.70.0070.00017.30
8.1.60.0030.00617.48
8.1.50.0030.00617.45
8.1.40.0060.00317.37
8.1.30.0040.00417.60
8.1.20.0080.00017.50
8.1.10.0080.00017.52
8.1.00.0040.00417.53
8.0.300.0070.00018.77
8.0.290.0040.00416.75
8.0.280.0040.00418.45
8.0.270.0030.00317.26
8.0.260.0000.00617.18
8.0.250.0030.00317.09
8.0.240.0000.00717.07
8.0.230.0030.00316.98
8.0.220.0000.00717.04
8.0.210.0060.00016.93
8.0.200.0040.00417.05
8.0.190.0050.00317.07
8.0.180.0030.00616.95
8.0.170.0060.00316.89
8.0.160.0040.00417.04
8.0.150.0000.00816.80
8.0.140.0070.00316.87
8.0.130.0050.00013.39
8.0.120.0050.00316.95
8.0.110.0000.00716.88
8.0.100.0000.00716.82
8.0.90.0000.00816.89
8.0.80.0060.00916.86
8.0.70.0040.00416.79
8.0.60.0040.00416.91
8.0.50.0040.00417.02
8.0.30.0080.01117.03
8.0.20.0110.00817.40
8.0.10.0040.00416.84
8.0.00.0090.01116.73
7.4.330.0000.00615.09
7.4.320.0000.00816.41
7.4.300.0060.00016.56
7.4.290.0030.00316.46
7.4.280.0030.00516.54
7.4.270.0030.00416.58
7.4.260.0060.00516.54
7.4.250.0000.00816.33
7.4.240.0040.00316.45
7.4.230.0000.00816.66
7.4.220.0070.01016.45
7.4.210.0140.00016.38
7.4.200.0000.00716.20
7.4.160.0060.00916.30
7.4.150.0320.02117.40
7.4.140.0150.00317.86
7.4.130.0110.00916.47
7.4.120.0100.01016.33
7.4.110.0080.00816.41
7.4.100.0170.00716.55
7.4.90.0100.00716.54
7.4.80.0000.02319.39
7.4.70.0100.01016.32
7.4.60.0030.01816.65
7.4.50.0050.00316.36
7.4.40.0090.00616.50
7.4.30.0090.00616.55
7.4.00.0070.01015.14
7.3.330.0020.00313.34
7.3.320.0030.00313.27
7.3.310.0070.00016.19
7.3.300.0040.00416.32
7.3.290.0060.00916.31
7.3.280.0120.00616.35
7.3.270.0140.00617.40
7.3.260.0080.00816.39
7.3.250.0120.00816.35
7.3.240.0140.00316.50
7.3.230.0060.01116.41
7.3.210.0070.01416.50
7.3.200.0130.00619.39
7.3.190.0090.01216.26
7.3.180.0060.01016.62
7.3.170.0030.01416.60
7.3.160.0110.00816.46
7.3.120.0040.01314.76
7.3.110.0030.01514.61
7.3.100.0030.01314.90
7.3.90.0050.00614.88
7.3.80.0060.00915.05
7.3.70.0030.00914.94
7.3.60.0030.01214.90
7.3.50.0080.00814.83
7.3.40.0060.00314.69
7.3.30.0060.00614.90
7.3.20.0030.01416.39
7.3.10.0090.00616.69
7.3.00.0050.00816.69
7.2.330.0110.00716.75
7.2.320.0070.01016.32
7.2.310.0160.00016.64
7.2.300.0060.00916.43
7.2.290.0070.01616.38
7.2.250.0100.00714.93
7.2.240.0080.01214.78
7.2.230.0080.00314.96
7.2.220.0090.00614.75
7.2.210.0060.00614.79
7.2.200.0080.00815.01
7.2.190.0030.01015.14
7.2.180.0060.01214.88
7.2.170.0040.00715.02
7.2.130.0030.01016.49
7.2.120.0060.00616.93
7.2.110.0060.00616.75
7.2.100.0030.01016.68
7.2.90.0090.00816.78
7.2.80.0080.00516.61
7.2.70.0080.00516.74
7.2.60.0070.00716.74
7.2.50.0030.00816.62
7.2.40.0030.01116.73
7.2.30.0070.00716.77
7.2.20.0060.00716.75
7.2.10.0020.01016.58
7.2.00.0040.00517.54
7.1.330.0000.01315.34
7.1.320.0110.00015.65
7.1.310.0040.01115.60
7.1.300.0110.00715.69
7.1.290.0100.00315.50
7.1.280.0000.00815.59
7.1.270.0100.00715.53
7.1.260.0100.00715.40
7.1.250.0040.01315.63
7.1.240.0040.00715.64
7.1.230.0060.00615.54
7.1.220.0000.01115.56
7.1.210.0060.00615.36
7.1.200.0080.00515.54
7.1.190.0060.00615.64
7.1.180.0000.01315.61
7.1.170.0040.01115.58
7.1.160.0090.00315.75
7.1.150.0040.01115.46
7.1.140.0030.01015.29
7.1.130.0090.00015.47
7.1.120.0030.01015.84
7.1.110.0110.00415.75
7.1.100.0020.01016.51
7.1.90.0030.00615.41
7.1.80.0060.01015.81
7.1.70.0070.00216.17
7.1.60.0090.00817.64
7.1.50.0050.01116.15
7.1.40.0000.01015.54
7.1.30.0140.00015.62
7.1.20.0030.01315.54
7.1.10.0000.01115.74
7.1.00.0060.04219.02
7.0.330.0000.01315.15
7.0.320.0060.00915.22
7.0.310.0040.00415.20
7.0.300.0040.00815.05
7.0.290.0000.00815.25
7.0.280.0070.00315.08
7.0.270.0090.00615.13
7.0.260.0000.00715.33
7.0.250.0070.00715.20
7.0.240.0030.00615.43
7.0.230.0090.00015.49
7.0.220.0040.01215.32
7.0.210.0110.00415.32
7.0.200.0050.00816.00
7.0.190.0060.00315.32
7.0.180.0060.01015.26
7.0.170.0040.01215.36
7.0.160.0030.00615.29
7.0.150.0070.00714.89
7.0.140.0040.03918.62
7.0.130.0060.00915.19
7.0.120.0030.00915.05
7.0.110.0030.00715.09
7.0.100.0070.01015.27
7.0.90.0040.00815.11
7.0.80.0090.00615.23
7.0.70.0080.00415.43
7.0.60.0060.04317.66
7.0.50.0090.02016.63
7.0.40.0090.04416.63
7.0.30.0160.04216.89
7.0.20.0120.03716.76
7.0.10.0080.02316.76
7.0.00.0080.04516.80
5.6.380.0040.00414.29
5.6.370.0000.01213.97
5.6.360.0030.00614.26
5.6.350.0040.01114.20
5.6.340.0080.00314.20
5.6.330.0040.00814.29
5.6.320.0030.01014.49
5.6.310.0030.01014.18
5.6.300.0080.00614.53
5.6.290.0080.00814.47
5.6.280.0110.03417.56
5.6.270.0030.01013.98
5.6.260.0100.00314.05
5.6.250.0030.01013.95
5.6.240.0060.00314.37
5.6.230.0000.01314.29
5.6.220.0030.01014.16
5.6.210.0050.04017.51
5.6.200.0070.04516.14
5.6.190.0020.02817.51
5.6.180.2000.02517.44
5.6.170.0220.04517.35
5.6.160.0020.02817.39
5.6.150.0050.02816.21
5.6.140.0060.02616.03
5.6.130.0020.04416.14
5.6.120.0050.04517.49
5.6.110.0110.02917.52
5.6.100.0050.04317.50
5.6.90.0070.03317.48
5.6.80.0080.02117.35
5.6.70.2300.02417.29
5.6.60.0030.00714.37
5.6.50.0030.01014.16
5.6.40.0030.00714.30
5.6.30.0030.01014.18
5.6.20.0040.00413.91
5.6.10.0030.00714.18
5.6.00.0090.00614.18
5.5.380.0060.00611.18
5.5.370.0080.00311.18
5.5.360.0060.00611.18
5.5.350.0050.03715.76
5.5.340.0070.04014.58
5.5.330.0020.02515.81
5.5.320.0130.02315.73
5.5.310.0130.01815.74
5.5.300.0030.02314.56
5.5.290.0100.04014.61
5.5.280.0120.03716.00
5.5.270.0070.04416.01
5.5.260.0110.04315.98
5.5.250.0020.04315.98
5.5.240.0170.03515.69
5.5.230.0030.00911.18
5.5.220.0030.00911.18
5.5.210.0040.00411.18
5.5.200.0070.00311.18
5.5.190.0030.00911.18
5.5.180.0120.00011.18
5.5.170.0030.00611.18
5.5.160.0040.00411.18
5.5.150.0030.00911.18
5.5.140.0040.00411.18
5.5.130.0030.01011.18
5.5.120.0030.00311.18
5.5.110.0000.00711.18
5.5.100.0000.00811.18
5.5.90.0030.00511.18
5.5.80.0120.00011.18
5.5.70.0070.00311.18
5.5.60.0050.00311.18
5.5.50.0030.00311.18
5.5.40.0000.00911.18
5.5.30.0000.00511.18
5.5.20.0030.00711.18
5.5.10.0000.01011.18
5.5.00.0060.00311.18
5.4.450.0320.02415.23
5.4.440.0170.02025.36
5.4.430.0160.02823.55
5.4.420.0210.02423.55
5.4.410.0300.02523.55
5.4.400.0130.02323.53
5.4.390.0050.02423.46
5.4.380.0430.03814.91
5.4.370.0430.03714.96
5.4.360.0480.02514.86
5.4.350.0300.03214.96
5.4.340.0450.03214.81
5.4.330.0090.00311.18
5.4.320.0020.02211.85
5.4.310.0040.02611.85
5.4.300.0060.02911.85
5.4.290.0050.02411.85
5.4.280.0080.02911.79
5.4.270.0050.02611.79
5.4.260.0070.01911.79
5.4.250.0060.02011.79
5.4.240.0030.02211.79
5.4.230.0040.02411.79
5.4.220.0070.02111.79
5.4.210.0080.01611.79
5.4.200.0040.02211.79
5.4.190.0040.02311.79
5.4.180.0030.02211.79
5.4.170.0050.02111.79
5.4.160.0060.01911.79
5.4.150.0020.02411.79
5.4.140.0030.02311.63
5.4.130.0050.02311.63
5.4.120.0040.02211.60
5.4.110.0070.01711.60
5.4.100.0050.02111.60
5.4.90.0040.02311.60
5.4.80.0050.02211.60
5.4.70.0040.02011.60
5.4.60.0050.02211.60
5.4.50.0060.02111.60
5.4.40.0060.02111.59
5.4.30.0070.02011.59
5.4.20.0050.02211.59
5.4.10.0020.02511.59
5.4.00.0060.02211.34
5.3.290.0020.02611.99
5.3.280.0080.02011.94
5.3.270.0070.02411.95
5.3.260.0060.02811.95
5.3.250.0050.02311.95
5.3.240.0050.02511.95
5.3.230.0050.02911.94
5.3.220.0040.02311.93
5.3.210.0040.02411.93
5.3.200.0070.03111.93
5.3.190.0090.01811.93
5.3.180.0060.02011.92
5.3.170.0050.02711.92
5.3.160.0040.03011.93
5.3.150.0070.02711.92
5.3.140.0020.03111.92
5.3.130.0060.02811.92
5.3.120.0060.02711.91
5.3.110.0050.02211.92
5.3.100.0060.02011.66
5.3.90.0040.02211.65
5.3.80.0060.02211.64
5.3.70.0050.02211.64
5.3.60.0060.02011.64
5.3.50.0080.01911.61
5.3.40.0020.02411.61
5.3.30.0070.02011.59
5.3.20.0050.02011.47
5.3.10.0060.01811.46
5.3.00.0070.02011.45
5.2.170.0070.01510.21
5.2.160.0030.02010.21
5.2.150.0030.01910.21
5.2.140.0040.01710.20
5.2.130.0040.01910.19
5.2.120.0060.01710.18
5.2.110.0030.01810.19
5.2.100.0050.01810.19
5.2.90.0030.01910.19
5.2.80.0040.01710.18
5.2.70.0020.01810.18
5.2.60.0040.01610.16
5.2.50.0050.01710.15
5.2.40.0040.01810.13
5.2.30.0050.01810.12
5.2.20.0060.01510.12
5.2.10.0060.01410.07
5.2.00.0040.01810.00
5.1.60.0020.0179.64
5.1.50.0040.0159.64
5.1.40.0060.0129.63
5.1.30.0040.0159.81
5.1.20.0020.0209.82
5.1.10.0060.0169.68
5.1.00.0050.0159.68
5.0.50.0020.0138.91
5.0.40.0020.0148.84
5.0.30.0030.0188.75
5.0.20.0030.0128.73
5.0.10.0070.0108.72
5.0.00.0060.0158.72
4.4.90.0020.0107.98
4.4.80.0020.0107.96
4.4.70.0020.0117.96
4.4.60.0020.0097.96
4.4.50.0020.0127.97
4.4.40.0030.0157.94
4.4.30.0050.0077.97
4.4.20.0020.0108.01
4.4.10.0010.0118.01
4.4.00.0050.0137.97
4.3.110.0030.0097.92
4.3.100.0020.0117.92
4.3.90.0020.0097.91
4.3.80.0040.0137.88
4.3.70.0030.0077.90
4.3.60.0010.0107.90
4.3.50.0020.0107.90
4.3.40.0050.0127.86
4.3.30.0030.0097.24
4.3.20.0030.0107.23
4.3.10.0030.0097.21
4.3.00.0020.00823.29

preferences:
46.59 ms | 401 KiB | 5 Q