3v4l.org

run code in 300+ PHP versions simultaneously
<?php const response_codes = [ ["Usuario incorrecto.", false], ["Password incorrecta.", false], ["Credenciales inválidas.", false], ["Logueado correctamente.", true], ["No se pudo conectar al servidor LDAP para validar las credenciales.", false] ]; /** * Looks up response id in response codes and return the appropriate message * * @param [int] $responseId - the id of the response. * @return array(string, bool) the response message and false if it is an error or true if it a success. */ function interpretResponse($id) { return response_codes[$id] ?? ["Error desconocido", false]; } for ($x = 0; $x < 6; ++$x) { var_export(interpretResponse($x)); echo "\n"; }

preferences:
62.11 ms | 402 KiB | 5 Q