routes[] = [ 'method' => $method, 'path' => $path, 'handler' => $handler ]; } public function dispatch(string $method, string $uri) { foreach ($this->routes as $route) { if ($route['method'] === $method && $route['path'] === $uri) { return call_user_func($route['handler']); } } http_response_code(404); echo "Not Found"; } }