Suppose there is such a text:

C:\AppServ\www\modules\test.php 

I need to leave test.php. How to do this in php?

2 answers 2

If you need to exotic here:

 <?php $str = 'C:\AppServ\www\modules\test.php'; $str = explode('\', $str); echo $str[count($str-1)]; ?> 

This method is not the best)

  • This one was rejected because it was painfully clumsy. Maybe something is easier to eat)? - Ilyushka Ovchinnikov
  • one
    better so echo array_pop(explode('\', $str)); - zb '
 <?php $str = 'C:\AppServ\www\modules\test.php'; strrchr($str, chr(92)); ?>