What are some methods in PHP to determine the file extension of an index file within a URL path?
To determine the file extension of an index file within a URL path in PHP, you can use the pathinfo() function which returns information about a file path. By using this function, you can extract the file extension from the URL path. Another method is to use regular expressions to match and extract the file extension from the URL path.
$url = "https://www.example.com/index.php";
$extension = pathinfo($url, PATHINFO_EXTENSION);
echo $extension;
```
```php
$url = "https://www.example.com/index.php";
preg_match('/\.[^.]*$/', $url, $matches);
$extension = isset($matches[0]) ? $matches[0] : '';
echo $extension;