$note){ $note['ID'] = $key; $notifications[$key] = $note; } // Back uri $_SESSION['back'] = $_SERVER['REQUEST_URI']; $result = array( 'result' => empty($notifications) ? [] : $notifications ); echo json_encode($result);