$path = '/var/www/html/index.php'; $name = getName($path); echo $name; // Output: index.php
$path = 'C:\\Users\\User\\Documents\\file.txt'; $name = getName($path); echo $name; // Output: file.txtIn this example, `$path` contains the path to a file in a Windows environment, and `getName()` returns the file name `file.txt`. `getName()` is a built-in PHP function and does not require any external package or library.