Suppose there is such a text:
C:\AppServ\www\modules\test.php
I need to leave test.php. How to do this in php?
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)
echo array_pop(explode('\', $str));
- zb ' <?php $str = 'C:\AppServ\www\modules\test.php'; strrchr($str, chr(92)); ?>
Source: https://ru.stackoverflow.com/questions/198592/
All Articles