The directory I'm working in is
C:\xampp\htdocs\example\profile\john_doe
I want to know how I'd echo john_doe
using this? I'm using PHP
if you are trying to get the base directory name , you can simply do this :
<?php
echo basename(__DIR__);
?>
Try basename function.
echo(basename('C:\xampp\htdocs\example\profile\john_doe'));
This should echo 'john_doe'.