3v4l.org

run code in 300+ PHP versions simultaneously
<?php $_SERVER["HTTP_USER_AGENT"] = "TeachMe-App v000003 Android 4.4.2 on generic"; $MinVersion["TeachMe-App"] = 000004; $Client["Client"] = "TeachMe-App"; if(!isset($_SERVER["HTTP_USER_AGENT"]) || array_search($Client["Client"], $AllowedClients) === FALSE) { header("X-API-Status: 40003 Invalid UserAgent"); die(); } if(strpos($_SERVER["HTTP_USER_AGENT"], "v") > 0) { //6-Stellige Versionsnummer hinter dem v auslesen $Client["Version"] = substr($_SERVER["HTTP_USER_AGENT"], strpos($_SERVER["HTTP_USER_AGENT"], "v") + 1, 6); $Client["Version"] = is_int($Client["Version"]) ? intval($Client["Version"]) : -1; } if($Client["Version"] < $MinVersion[$Client["Client"]]) { header("X-API-Status: 40004 Client-Version Too Old"); die("40004"); } print_r($Client); die("40000");
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Warning: Undefined variable $AllowedClients in /in/taKHg on line 7 Fatal error: Uncaught TypeError: array_search(): Argument #2 ($haystack) must be of type array, null given in /in/taKHg:7 Stack trace: #0 /in/taKHg(7): array_search('TeachMe-App', NULL) #1 {main} thrown in /in/taKHg on line 7
Process exited with code 255.
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Notice: Undefined variable: AllowedClients in /in/taKHg on line 7 Warning: array_search() expects parameter 2 to be array, null given in /in/taKHg on line 7 Warning: Cannot modify header information - headers already sent by (output started at /in/taKHg:7) in /in/taKHg on line 22 40004
Output for 7.3.32 - 7.3.33
Warning: array_search() expects parameter 2 to be array, null given in /in/taKHg on line 7 Warning: Cannot modify header information - headers already sent by (output started at /in/taKHg:7) in /in/taKHg on line 22 40004
Output for 5.2.3 - 5.2.17
Notice: Undefined variable: AllowedClients in /in/taKHg on line 7 Warning: array_search(): Wrong datatype for second argument in /in/taKHg on line 7 Warning: Cannot modify header information - headers already sent by (output started at /in/taKHg:7) in /in/taKHg on line 9
Output for 5.0.4 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.2
Notice: Undefined variable: AllowedClients in /in/taKHg on line 7 Warning: array_search(): Wrong datatype for second argument in /in/taKHg on line 7
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.3
Notice: Undefined variable: AllowedClients in /in/taKHg on line 7 Warning: array_search(): Wrong datatype for second argument in /in/taKHg on line 7
Output for 4.3.0 - 4.3.1
Notice: Undefined variable: AllowedClients in /in/taKHg on line 7 Warning: array_search() [http://www.php.net/function.array-search]: Wrong datatype for second argument in /in/taKHg on line 7

preferences:
224.12 ms | 401 KiB | 350 Q