src/PhpConsole/EvalProvider.php
public function evaluate($code) {
		$code = $this->applyHandlersToCode($code);
		$code = $this->adaptCodeToEval($code);

		$this->backupGlobals();
		$this->applyOpenBaseDirSetting();

		$startTime = microtime(true);
		static::executeCode('', $this->sharedVars);
		$selfTime = microtime(true) - $startTime;

		ob_start();
		$result = new EvalResult();
		$startTime = microtime(true);
		try {
			$result->return = static::executeCode($code, $this->sharedVars);
		}
		catch(\Throwable $exception) {
			$result->exception = $exception;
		}
		catch(\Exception $exception) {
			$result->exception = $exception;
		}
		$result->time = abs(microtime(true) - $startTime - $selfTime);
		$result->output = ob_get_clean();

		$this->restoreGlobals();

		return $result;
	}
public function evaluate($code) {
		$code = $this->applyHandlersToCode($code);
		$code = $this->adaptCodeToEval($code);

		$this->backupGlobals();
		$this->applyOpenBaseDirSetting();

		$startTime = microtime(true);
		static::executeCode('', $this->sharedVars);
		$selfTime = microtime(true) - $startTime;

		ob_start();
		$result = new EvalResult();
		$startTime = microtime(true);
		try {
			$result->return = static::executeCode($code, $this->sharedVars);
		}
		catch(\Throwable $exception) {
			$result->exception = $exception;
		}
		catch(\Exception $exception) {
			$result->exception = $exception;
		}
		$result->time = abs(microtime(true) - $startTime - $selfTime);
		$result->output = ob_get_clean();

		$this->restoreGlobals();

		return $result;
	}
public function evaluate ( $ code ) { $ code = $ this -> applyHandlersToCode ( $ code ) ; $ code = $ this -> adaptCodeToEval ( $ code ) ; $ this -> backupGlobals ( ) ; $ this -> applyOpenBaseDirSetting ( ) ; $ startTime = microtime ( true ) ; static :: executeCode ( '' , $ this -> sharedVars ) ; $ selfTime = microtime ( true ) - $ startTime ; ob_start ( ) ; $ result = new EvalResult ( ) ; $ startTime = microtime ( true ) ; try { $ result -> return = static :: executeCode ( $ code , $ this -> sharedVars ) ; } catch ( \ Throwable $ exception ) { $ result -> exception = $ exception ; } catch ( \ Exception $ exception ) { $ result -> exception = $ exception ; } $ result -> time = abs ( microtime ( true ) - $ startTime - $ selfTime ) ; $ result -> output = ob_get_clean ( ) ; $ this -> restoreGlobals ( ) ; return $ result ; }
Execute PHP code handling execution time, output & exception
@param string $code
@return EvalResult
Execute PHP code handling execution time output & exception