3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Zend_Registry extends ArrayObject { /** * Class name of the singleton registry object. * @var string */ private static $_registryClassName = 'Zend_Registry'; /** * Registry object provides storage for shared objects. * @var Zend_Registry */ private static $_registry = null; /** * Retrieves the default registry instance. * * @return Zend_Registry */ public static function getInstance() { if (self::$_registry === null) { self::init(); } return self::$_registry; } /** * Set the default registry instance to a specified instance. * * @param Zend_Registry $registry An object instance of type Zend_Registry, * or a subclass. * @return void * @throws Zend_Exception if registry is already initialized. */ public static function setInstance(Zend_Registry $registry) { if (self::$_registry !== null) { require_once 'Zend/Exception.php'; throw new Zend_Exception('Registry is already initialized'); } self::setClassName(get_class($registry)); self::$_registry = $registry; } /** * Initialize the default registry instance. * * @return void */ protected static function init() { self::setInstance(new self::$_registryClassName()); } /** * Set the class name to use for the default registry instance. * Does not affect the currently initialized instance, it only applies * for the next time you instantiate. * * @param string $registryClassName * @return void * @throws Zend_Exception if the registry is initialized or if the * class name is not valid. */ public static function setClassName($registryClassName = 'Zend_Registry') { if (self::$_registry !== null) { require_once 'Zend/Exception.php'; throw new Zend_Exception('Registry is already initialized'); } if (!is_string($registryClassName)) { require_once 'Zend/Exception.php'; throw new Zend_Exception("Argument is not a class name"); } /** * @see Zend_Loader */ if (!class_exists($registryClassName)) { require_once 'Zend/Loader.php'; Zend_Loader::loadClass($registryClassName); } self::$_registryClassName = $registryClassName; } /** * Unset the default registry instance. * Primarily used in tearDown() in unit tests. * @returns void */ public static function _unsetInstance() { self::$_registry = null; } /** * getter method, basically same as offsetGet(). * * This method can be called from an object of type Zend_Registry, or it * can be called statically. In the latter case, it uses the default * static instance stored in the class. * * @param string $index - get the value associated with $index * @return mixed * @throws Zend_Exception if no entry is registerd for $index. */ public static function get($index) { $instance = self::getInstance(); if (!$instance->offsetExists($index)) { require_once 'Zend/Exception.php'; throw new Zend_Exception("No entry is registered for key '$index'"); } return $instance->offsetGet($index); } /** * setter method, basically same as offsetSet(). * * This method can be called from an object of type Zend_Registry, or it * can be called statically. In the latter case, it uses the default * static instance stored in the class. * * @param string $index The location in the ArrayObject in which to store * the value. * @param mixed $value The object to store in the ArrayObject. * @return void */ public static function set($index, $value) { $instance = self::getInstance(); $instance->offsetSet($index, $value); } /** * Returns TRUE if the $index is a named value in the registry, * or FALSE if $index was not found in the registry. * * @param string $index * @return boolean */ public static function isRegistered($index) { if (self::$_registry === null) { return false; } return self::$_registry->offsetExists($index); } /** * Constructs a parent ArrayObject with default * ARRAY_AS_PROPS to allow acces as an object * * @param array $array data array * @param integer $flags ArrayObject flags */ public function __construct($array = array(), $flags = parent::ARRAY_AS_PROPS) { parent::__construct($array, $flags); } /** * @param string $index * @returns mixed * * Workaround for http://bugs.php.net/bug.php?id=40442 (ZF-960). */ /*public function offsetExists($index) { return array_key_exists($index, $this); }*/ } $registry = Zend_Registry::getInstance(); $registry['null'] = null; var_dump(isset($registry['null'])); var_dump(Zend_Registry::isRegistered('null'));

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.40.0180.00318.83
8.3.30.0120.00619.08
8.3.20.0040.00420.20
8.3.10.0110.00423.64
8.3.00.0030.00719.23
8.2.170.0070.00722.96
8.2.160.0100.00320.39
8.2.150.0050.00324.18
8.2.140.0070.00024.66
8.2.130.0040.00426.16
8.2.120.0070.00022.20
8.2.110.0060.00322.24
8.2.100.0080.00417.84
8.2.90.0000.00819.35
8.2.80.0080.00018.16
8.2.70.0000.00917.63
8.2.60.0030.00617.93
8.2.50.0030.00618.07
8.2.40.0030.00519.88
8.2.30.0040.00418.15
8.2.20.0060.00317.84
8.2.10.0000.00718.23
8.2.00.0000.00917.83
8.1.270.0030.00622.19
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0030.00623.88
8.1.230.0000.01118.91
8.1.220.0030.00517.74
8.1.210.0120.00018.77
8.1.200.0060.00317.48
8.1.190.0040.00417.54
8.1.180.0050.00318.10
8.1.170.0000.00818.59
8.1.160.0030.00521.98
8.1.150.0050.00218.69
8.1.140.0070.00317.50
8.1.130.0050.00317.96
8.1.120.0000.00717.59
8.1.110.0020.00517.50
8.1.100.0000.00717.53
8.1.90.0070.00017.52
8.1.80.0030.00317.41
8.1.70.0030.00317.46
8.1.60.0000.00717.56
8.1.50.0030.00517.55
8.1.40.0040.00417.57
8.1.30.0030.00517.66
8.1.20.0040.00417.77
8.1.10.0040.00417.51
8.1.00.0060.00317.54
8.0.300.0040.00419.16
8.0.290.0000.00717.30
8.0.280.0030.00318.49
8.0.270.0000.00717.21
8.0.260.0040.00417.22
8.0.250.0000.00716.96
8.0.240.0000.00717.05
8.0.230.0040.00417.07
8.0.220.0000.00716.99
8.0.210.0080.00017.07
8.0.200.0030.00316.93
8.0.190.0030.00616.95
8.0.180.0030.00616.99
8.0.170.0000.00816.95
8.0.160.0050.00316.96
8.0.150.0040.00416.93
8.0.140.0030.00417.02
8.0.130.0040.00413.42
8.0.120.0040.00417.02
8.0.110.0020.00517.00
8.0.100.0040.00416.83
8.0.90.0000.00717.04
8.0.80.0030.01317.01
8.0.70.0040.00416.89
8.0.60.0070.00017.04
8.0.50.0040.00417.11
8.0.30.0130.00517.15
8.0.20.0120.00617.40
8.0.10.0050.00317.13
8.0.00.0060.01216.95
7.4.330.0060.00015.14
7.4.320.0000.00616.55
7.4.300.0030.00316.65
7.4.290.0050.00216.68
7.4.280.0000.00816.45
7.4.270.0040.00416.56
7.4.260.0000.00716.63
7.4.250.0000.00716.43
7.4.240.0060.00216.54
7.4.230.0000.00816.39
7.4.220.0030.01316.59
7.4.210.0070.00816.65
7.4.200.0040.00416.65
7.4.190.0030.00316.78
7.4.160.0030.01316.59
7.4.150.0140.01017.40
7.4.140.0100.00817.86
7.4.130.0090.00916.57
7.4.120.0160.00516.56
7.4.110.0130.00316.51
7.4.100.0150.00616.57
7.4.90.0060.01116.47
7.4.80.0060.01819.39
7.4.70.0080.01416.46
7.4.60.0100.00616.62
7.4.50.0040.00016.46
7.4.40.0040.00822.77
7.4.30.0080.00816.47
7.4.10.0060.01014.95
7.4.00.0080.01114.90
7.3.330.0030.00313.44
7.3.320.0050.00013.48
7.3.310.0000.00716.30
7.3.300.0030.00316.45
7.3.290.0070.00716.43
7.3.280.0120.00616.40
7.3.270.0120.00617.40
7.3.260.0170.00416.37
7.3.250.0140.00716.37
7.3.240.0120.00816.57
7.3.230.0120.01216.39
7.3.210.0030.01416.57
7.3.200.0090.01419.39
7.3.190.0100.01416.50
7.3.180.0030.01316.38
7.3.170.0060.00916.70
7.3.160.0090.00616.51
7.3.130.0000.01814.64
7.3.120.0020.01514.99
7.3.110.0100.00714.87
7.3.100.0040.01415.09
7.3.90.0040.00815.13
7.3.80.0040.01114.85
7.3.70.0070.01014.85
7.3.60.0120.00614.92
7.3.50.0060.00314.89
7.3.40.0040.01115.04
7.3.30.0070.00714.89
7.3.20.0030.00716.77
7.3.10.0000.01016.49
7.3.00.0070.00716.45
7.2.330.0070.01116.88
7.2.320.0110.00916.89
7.2.310.0060.01616.46
7.2.300.0080.00816.68
7.2.290.0080.00816.43
7.2.260.0070.01115.27
7.2.250.0040.00815.12
7.2.240.0090.00615.39
7.2.230.0060.00915.04
7.2.220.0000.01514.73
7.2.210.0110.00415.37
7.2.200.0090.00615.02
7.2.190.0060.00615.25
7.2.180.0110.00315.02
7.2.170.0120.00315.04
7.2.160.0060.00915.33
7.2.150.0040.00816.88
7.2.140.0000.01316.93
7.2.130.0000.00916.83
7.2.120.0070.00716.98
7.2.110.0130.00316.97
7.2.100.0030.01216.76
7.2.90.0110.00417.04
7.2.80.0070.01016.70
7.2.70.0070.00716.99
7.2.60.0070.00916.95
7.2.50.0070.01016.97
7.2.40.0040.00816.72
7.2.30.0060.01016.98
7.2.20.0030.01016.87
7.2.10.0100.00316.86
7.2.00.0070.00518.28
7.1.330.0060.01015.69
7.1.320.0110.00415.96
7.1.310.0070.00715.96
7.1.300.0030.00915.52
7.1.290.0040.00815.79
7.1.280.0070.00715.99
7.1.270.0070.00715.69
7.1.260.0000.01515.85
7.1.250.0070.00715.80
7.1.240.0000.01515.76
7.1.230.0060.00615.88
7.1.220.0030.00815.89
7.1.210.0000.00915.69
7.1.200.0040.00915.75
7.1.190.0110.00615.77
7.1.180.0030.01415.55
7.1.170.0040.01415.85
7.1.160.0100.00315.85
7.1.150.0040.00415.84
7.1.140.0030.00715.83
7.1.130.0030.00615.69
7.1.120.0070.00715.87
7.1.110.0070.00315.90
7.1.100.0080.00516.87
7.1.90.0030.01016.04
7.1.80.0030.01016.06
7.1.70.0030.00516.43
7.1.60.0060.01317.71
7.1.50.0120.01125.16
7.1.40.0060.00615.79
7.1.30.0150.00315.91
7.1.20.0070.00315.87
7.1.10.0000.00815.93
7.1.00.0020.04419.16
7.0.330.0000.01215.38
7.0.320.0030.01015.60
7.0.310.0030.01415.53
7.0.300.0000.01515.38
7.0.290.0030.01215.49
7.0.280.0070.00715.22
7.0.270.0060.00615.20
7.0.260.0000.01315.23
7.0.250.0070.00715.38
7.0.240.0100.00015.47
7.0.230.0070.01115.47
7.0.220.0040.00715.23
7.0.210.0060.00615.18
7.0.200.0040.00616.18
7.0.190.0060.00615.23
7.0.180.0090.00415.43
7.0.170.0000.01015.44
7.0.160.0030.00915.60
7.0.150.0030.00615.47
7.0.140.0050.04118.84
7.0.130.0030.01015.56
7.0.120.0090.00615.45
7.0.110.0040.01115.21
7.0.100.0030.00915.35
7.0.90.0000.00915.56
7.0.80.0030.00615.43
7.0.70.0070.00315.48
7.0.60.0050.04517.78
7.0.50.0070.03816.77
7.0.40.0120.04516.73
7.0.30.0140.02216.92
7.0.20.0170.04216.75
7.0.10.0050.04916.72
7.0.00.0050.03516.84
5.6.400.0070.00714.57
5.6.390.0030.00614.34
5.6.380.0000.01014.16
5.6.370.0070.00714.64
5.6.360.0070.01014.72
5.6.350.0040.01114.50
5.6.340.0030.00914.72
5.6.330.0060.00314.59
5.6.320.0030.00614.25
5.6.310.0000.01314.48
5.6.300.0040.01114.35
5.6.290.0060.00614.74
5.6.280.0100.03617.73
5.6.270.0040.01514.59
5.6.260.0030.01414.21
5.6.250.0080.00414.59
5.6.240.0030.00714.57
5.6.230.0120.00314.28
5.6.220.0030.00614.48
5.6.210.0080.04517.37
5.6.200.0050.04716.53
5.6.190.0020.04517.71
5.6.180.0050.04717.40
5.6.170.0130.02017.63
5.6.160.0080.03817.34
5.6.150.0070.04516.35
5.6.140.0110.02316.24
5.6.130.0030.03116.40
5.6.120.0030.03517.85
5.6.110.0070.04017.85
5.6.100.0030.02317.77
5.6.90.0070.03517.59
5.6.80.0070.04417.38
5.6.70.0090.00614.30
5.6.60.0030.01314.61
5.6.50.0060.00814.16
5.6.40.0060.00614.27
5.6.30.0030.01014.49
5.6.20.0070.00714.28
5.6.10.0000.01214.34
5.6.00.0040.00714.38
5.5.380.0000.01214.56
5.5.370.0060.00614.48
5.5.360.0030.00914.59
5.5.350.0070.04017.39
5.5.340.0120.04016.03
5.5.330.0100.04317.37
5.5.320.0130.03017.38
5.5.310.0140.04217.39
5.5.300.0030.03616.30
5.5.290.0020.05016.43
5.5.280.0080.04617.67
5.5.270.0050.03017.51
5.5.260.0150.04317.73
5.5.250.0050.03017.61
5.5.240.0050.04217.40
5.5.230.0030.00914.44
5.5.220.0030.01314.29
5.5.210.0120.00014.45
5.5.200.0050.00514.52
5.5.190.0070.00714.75
5.5.180.0030.01414.37
5.5.170.0070.00414.55
5.5.160.0000.01214.56
5.5.150.0070.01014.48
5.5.140.0100.00314.28
5.5.130.0070.00314.39
5.5.120.0030.00614.24
5.5.110.0030.01014.21
5.5.100.0100.00314.52
5.5.90.0040.00714.42
5.5.80.0040.00814.21
5.5.70.0040.00814.50
5.5.60.0110.00414.42
5.5.50.0060.00314.45
5.5.40.0100.00714.12
5.5.30.0040.01114.47
5.5.20.0000.01014.20
5.5.10.0030.01014.17
5.5.00.0100.00313.89
5.4.450.0150.02815.68
5.4.440.0160.03715.77
5.4.430.0230.04015.60
5.4.420.0130.02715.75
5.4.410.0180.02815.78
5.4.400.0150.02415.68
5.4.390.0180.03915.50
5.4.380.0130.03915.52
5.4.370.0080.04215.57
5.4.360.0160.02915.63
5.4.350.0180.03315.46
5.4.340.0230.02315.49
5.4.330.0060.00612.04
5.4.320.0220.03215.53
5.4.310.0100.04415.62
5.4.300.0200.03515.57
5.4.290.0180.03715.46
5.4.280.0160.03715.60
5.4.270.0160.03615.59
5.4.260.0130.02215.52
5.4.250.0130.02315.45
5.4.240.0170.03715.58
5.4.230.0200.02715.60
5.4.220.0180.03515.44
5.4.210.0170.03515.51
5.4.200.0150.02915.62
5.4.190.0240.03215.64
5.4.180.0150.02715.56
5.4.170.0110.02315.59
5.4.160.0130.02415.48
5.4.150.0150.03315.55
5.4.140.0150.03814.21
5.4.130.0120.02014.17
5.4.120.0150.03714.26
5.4.110.0090.04114.26
5.4.100.0190.03314.32
5.4.90.0170.03814.32
5.4.80.0130.02314.30
5.4.70.0130.02114.16
5.4.60.0120.03814.30
5.4.50.0210.03414.24
5.4.40.0180.02314.14
5.4.30.0130.03514.15
5.4.20.0180.02714.29
5.4.10.0150.04014.29
5.4.00.0130.02313.92
5.3.290.0120.03813.33
5.3.280.0180.02813.32
5.3.270.0080.03013.33
5.3.260.0200.02813.38
5.3.250.0100.03213.30
5.3.240.0150.03613.34
5.3.230.0120.02013.28
5.3.220.0170.02813.37
5.3.210.0130.02813.29
5.3.200.0180.03713.34
5.3.190.0140.04313.34
5.3.180.0180.03013.39
5.3.170.0080.02813.37
5.3.160.0120.03113.27
5.3.150.0150.03513.31
5.3.140.0130.02513.40
5.3.130.0150.02813.31
5.3.120.0160.02513.42
5.3.110.0170.03013.37
5.3.100.0170.02113.05
5.3.90.0160.02013.03
5.3.80.0180.03513.10
5.3.70.0200.03213.00
5.3.60.0100.02612.99
5.3.50.0150.03313.05
5.3.40.0150.02312.96
5.3.30.0100.03212.99
5.3.20.0140.03912.96
5.3.10.0150.03512.82
5.3.00.0170.03612.92
5.2.170.0200.05312.03
5.2.160.0170.05312.03
5.2.150.0100.06712.03
5.2.140.0200.06312.03
5.2.130.0170.03312.03
5.2.120.0130.04312.03
5.2.110.0230.05012.03
5.2.100.0200.05312.03
5.2.90.0200.05312.03
5.2.80.0200.04712.03
5.2.70.0170.05712.03
5.2.60.0230.05012.03
5.2.50.0200.05012.03
5.2.40.0170.03312.03
5.2.30.0230.05712.03
5.2.20.0330.05012.03
5.2.10.0170.04712.03
5.2.00.0130.05712.03
5.1.60.0170.03312.03
5.1.50.0200.04312.03
5.1.40.0330.04012.03
5.1.30.0270.05312.03
5.1.20.0170.05012.03
5.1.10.0200.05012.03
5.1.00.0200.04712.03
5.0.50.0100.04312.03
5.0.40.0130.03312.03
5.0.30.0100.04712.03
5.0.20.0170.04012.03
5.0.10.0170.03312.03
5.0.00.0100.05012.03
4.4.90.0100.02712.03
4.4.80.0100.01712.03
4.4.70.0100.03712.03
4.4.60.0170.01712.03
4.4.50.0100.03012.03
4.4.40.0070.05712.03
4.4.30.0070.02712.03
4.4.20.0100.03712.03
4.4.10.0070.04012.03
4.4.00.0200.04312.03
4.3.110.0070.03312.03
4.3.100.0130.03012.03
4.3.90.0130.02712.03
4.3.80.0130.05012.03
4.3.70.0100.02712.03
4.3.60.0070.03312.03
4.3.50.0070.02712.03
4.3.40.0070.03312.03
4.3.30.0030.03712.03
4.3.20.0000.03012.03
4.3.10.0070.02712.03
4.3.00.0030.03012.03

preferences:
47.86 ms | 400 KiB | 5 Q