3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ClosureStatementFactory implements StatementFactory { private $closure; function __construct(callable $closure) { $this->closure = $closure; } function create(\mysqli_stmt $statement, $queryString) { $function = $this->closure; $statementWrapper = $function($statement, $queryString); return $statementWrapper; } } function createTimerProxyXMySQLiStatementFactory(Timer $timer, Logger $logger) { //This is generated by the proxy builder which also generates the TimerProxyXMySQLiStatement class $closure = function ($statement, $queryString) use ($timer, logger) { $object = new TimerProxyXMySQLiStatement( $statement, $queryString, $logger, $timer ); return $object; }; return new ClosureStatementFactory($closure); } $provider->delegate(StatementFactory::class, 'createTimerProxyXMySQLiStatementFactory'); class DBConnection { //The database connection class needs to be able to make statement classes function __construct(StatementFactory $statementFactory) { $this->statementFactory = statementFactory; } function prepareQuery($query) { $mysqliStatement = $this->mysqli->prepareStatement($query); return $this->statementFactory->create($mysqliStatement, $queryString); } }
Output for 5.4.0 - 5.4.28
Parse error: syntax error, unexpected 'logger' (T_STRING), expecting '&' or variable (T_VARIABLE) in /in/3aO8E on line 24
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_STRING, expecting '&' or T_VARIABLE in /in/3aO8E on line 24
Process exited with code 255.
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/3aO8E on line 13 Parse error: syntax error, unexpected T_FUNCTION in /in/3aO8E on line 24
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/3aO8E on line 13 Parse error: parse error, unexpected T_FUNCTION in /in/3aO8E on line 24
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting '{' in /in/3aO8E on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting '{' in /in/3aO8E on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `'{'' in /in/3aO8E on line 5
Process exited with code 255.

preferences:
202.75 ms | 1399 KiB | 118 Q