function login(Array $data){ // Whatever your code does } if($_POST['action'] == "login") { login($_POST); }