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"; }
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
array ( 0 => 'Usuario incorrecto.', 1 => false, ) array ( 0 => 'Password incorrecta.', 1 => false, ) array ( 0 => 'Credenciales inválidas.', 1 => false, ) array ( 0 => 'Logueado correctamente.', 1 => true, ) array ( 0 => 'No se pudo conectar al servidor LDAP para validar las credenciales.', 1 => false, ) array ( 0 => 'Error desconocido', 1 => false, )

preferences:
164.91 ms | 404 KiB | 211 Q