programming-examples/php/String/PHP script to extract the file name from the following string..php

5 lines
143 B
PHP
Raw Permalink Normal View History

2019-11-15 12:59:38 +01:00
<?php
$path = 'www.example.com/public_html/index.php';
$file_name = substr(strrchr($path, "/"), 1);
echo $file_name."\n"; // "index.php"
?>