3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace teachme; ApiError(123, "Fuck"); function ApiError($ErrorCode, $ErrorMsg) { header("X-API-Status: ".$ErrorCode." ".$ErrorMsg); if($ErrorCode != 40000) { $Message = $ErrorCode." ".$ErrorMsg."" . " - [".$_SERVER["HTTP-USER-AGENT"]."]" . " - [".$_SERVER["REMOTE_ADDR"]."]" . " - (User: ".(($_SESSION["TeachMe-Server"]["loggedin"] === true) ? $_SESSION["TeachMe-Server"]["User"]["ID"] : "<none>").")"; error_log($Message, 3, '../data/api_error.log'); } die(); }
Output for 8.3.0 - 8.3.6
Warning: Undefined array key "HTTP-USER-AGENT" in /in/3Q1Fr on line 11 Warning: Undefined array key "REMOTE_ADDR" in /in/3Q1Fr on line 12 Warning: Undefined global variable $_SESSION in /in/3Q1Fr on line 13 Warning: Trying to access array offset on null in /in/3Q1Fr on line 13 Warning: Trying to access array offset on null in /in/3Q1Fr on line 13 Warning: error_log(): open_basedir restriction in effect. File(../data/api_error.log) is not within the allowed path(s): (/tmp:/in:/etc) in /in/3Q1Fr on line 14 Warning: error_log(../data/api_error.log): Failed to open stream: Operation not permitted in /in/3Q1Fr on line 14
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
Warning: Undefined array key "HTTP-USER-AGENT" in /in/3Q1Fr on line 11 Warning: Undefined array key "REMOTE_ADDR" in /in/3Q1Fr on line 12 Warning: Undefined global variable $_SESSION in /in/3Q1Fr on line 13 Warning: Trying to access array offset on value of type null in /in/3Q1Fr on line 13 Warning: Trying to access array offset on value of type null in /in/3Q1Fr on line 13 Warning: error_log(): open_basedir restriction in effect. File(../data/api_error.log) is not within the allowed path(s): (/tmp:/in:/etc) in /in/3Q1Fr on line 14 Warning: error_log(../data/api_error.log): Failed to open stream: Operation not permitted in /in/3Q1Fr on line 14
Output for 8.0.0 - 8.0.12, 8.0.14 - 8.0.30
Warning: Undefined array key "HTTP-USER-AGENT" in /in/3Q1Fr on line 11 Warning: Undefined array key "REMOTE_ADDR" in /in/3Q1Fr on line 12 Warning: Undefined variable $_SESSION in /in/3Q1Fr on line 13 Warning: Trying to access array offset on value of type null in /in/3Q1Fr on line 13 Warning: Trying to access array offset on value of type null in /in/3Q1Fr on line 13 Warning: error_log(): open_basedir restriction in effect. File(../data/api_error.log) is not within the allowed path(s): (/tmp:/in:/etc) in /in/3Q1Fr on line 14 Warning: error_log(../data/api_error.log): Failed to open stream: Operation not permitted in /in/3Q1Fr on line 14
Output for 8.0.13
Warning: Undefined array key "HTTP-USER-AGENT" in /in/3Q1Fr on line 11 Warning: Undefined array key "REMOTE_ADDR" in /in/3Q1Fr on line 12 Warning: Undefined variable $_SESSION in /in/3Q1Fr on line 13 Warning: Trying to access array offset on value of type null in /in/3Q1Fr on line 13 Warning: Trying to access array offset on value of type null in /in/3Q1Fr on line 13 Warning: error_log(../data/api_error.log): Failed to open stream: No such file or directory in /in/3Q1Fr on line 14
Output for 7.4.33
Notice: Undefined index: HTTP-USER-AGENT in /in/3Q1Fr on line 11 Notice: Undefined index: REMOTE_ADDR in /in/3Q1Fr on line 12 Notice: Undefined variable: _SESSION in /in/3Q1Fr on line 13 Notice: Trying to access array offset on value of type null in /in/3Q1Fr on line 13 Notice: Trying to access array offset on value of type null in /in/3Q1Fr on line 13 Warning: error_log(../data/api_error.log): failed to open stream: No such file or directory in /in/3Q1Fr on line 14
Output for 7.4.0 - 7.4.32
Notice: Undefined index: HTTP-USER-AGENT in /in/3Q1Fr on line 11 Notice: Undefined index: REMOTE_ADDR in /in/3Q1Fr on line 12 Notice: Undefined variable: _SESSION in /in/3Q1Fr on line 13 Notice: Trying to access array offset on value of type null in /in/3Q1Fr on line 13 Notice: Trying to access array offset on value of type null in /in/3Q1Fr on line 13 Warning: error_log(): open_basedir restriction in effect. File(../data/api_error.log) is not within the allowed path(s): (/tmp:/in:/etc) in /in/3Q1Fr on line 14 Warning: error_log(../data/api_error.log): failed to open stream: Operation not permitted in /in/3Q1Fr on line 14
Output for 7.3.32 - 7.3.33
Warning: error_log(../data/api_error.log): failed to open stream: No such file or directory in /in/3Q1Fr on line 14
Output for 7.1.26 - 7.1.33, 7.2.17 - 7.2.33, 7.3.0 - 7.3.31
Notice: Undefined index: HTTP-USER-AGENT in /in/3Q1Fr on line 11 Notice: Undefined index: REMOTE_ADDR in /in/3Q1Fr on line 12 Notice: Undefined variable: _SESSION in /in/3Q1Fr on line 13 Warning: error_log(): open_basedir restriction in effect. File(../data/api_error.log) is not within the allowed path(s): (/tmp:/in:/etc) in /in/3Q1Fr on line 14 Warning: error_log(../data/api_error.log): failed to open stream: Operation not permitted in /in/3Q1Fr on line 14
Output for 7.1.20, 7.2.6
Notice: Undefined index: HTTP-USER-AGENT in /in/3Q1Fr on line 11 Notice: Undefined index: REMOTE_ADDR in /in/3Q1Fr on line 12 Notice: Undefined variable: _SESSION in /in/3Q1Fr on line 13 Warning: error_log(): open_basedir restriction in effect. File(../data/api_error.log) is not within the allowed path(s): (/tmp:/in) in /in/3Q1Fr on line 14 Warning: error_log(../data/api_error.log): failed to open stream: Operation not permitted in /in/3Q1Fr on line 14
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.10, 7.2.0
Notice: Undefined index: HTTP-USER-AGENT in /in/3Q1Fr on line 11 Notice: Undefined index: REMOTE_ADDR in /in/3Q1Fr on line 12 Notice: Undefined variable: _SESSION in /in/3Q1Fr on line 13 Warning: error_log(../data/api_error.log): failed to open stream: No such file or directory in /in/3Q1Fr on line 14
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Parse error: syntax error, unexpected T_STRING in /in/3Q1Fr on line 2
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, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_STRING in /in/3Q1Fr on line 2
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/3Q1Fr on line 2
Process exited with code 255.

preferences:
306.07 ms | 401 KiB | 385 Q