3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php /** * The basic registry interface. * * @author Time.ly Network, Inc. * @since 2.0 * @package Ai1EC * @subpackage Ai1EC.Object */ interface Ai1ec_Registry { /** * Retrieves the key from the registry * * @param string $key * * @return mixed the value associated to the key. */ public function get( $key ); /** * Set the key into the registry. * * @param string $key * @param mixed $value */ public function set( $key, $value ); } /** * Application Registry: handles application wide variables. * * @author Time.ly Network, Inc. * @since 2.0 * @package Ai1EC * @subpackage Ai1EC.Object */ class Ai1ec_Registry_Application implements Ai1ec_Registry { /** * @var array */ protected $_environment = array(); /* (non-PHPdoc) * @see Ai1ec_Registry::get() */ public function get( $key ) { if ( ! isset ( $this->_environment[$key] ) ) { return false; } return $this->_environment[$key]; } /* (non-PHPdoc) * @see Ai1ec_Registry::set() */ public function set( $key, $value ) { $this->_environment[$key] = $value; } } $app = new Ai1ec_Registry_Application(); $app->set( 'foo', 'baz' ); echo $app->get( 'foo' );
Output for 5.0.0 - 7.1.0
baz
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING in /in/ie1nQ on line 10
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING in /in/ie1nQ on line 10
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/ie1nQ on line 10
Process exited with code 255.