Extract directory from path


/ Published in: PHP
Save to your folder(s)

Extract directory from path


Copy this code and paste it in your HTML
  1. $s = '/dirname/subdir/filename.txt';
  2.  
  3. $dirname = strrev(strstr(strrev($s),'/'));

Report this snippet


Comments


You need to login to view comments.