Getting relative path from absolute path in PHP

Posted by SpawnCxy on Stack Overflow See other posts from Stack Overflow or by SpawnCxy
Published on 2010-04-14T13:58:58Z Indexed on 2010/04/14 14:33 UTC
Read the original article Hit count: 327

Filed under:
|

I noticed that there're some similar questions about this problem when I typed the title,but they seem not be in PHP.So what's the solution to it with a PHP function?

To be specified.

$a="/home/apache/a/a.php";
$b="/home/root/b/b.php";
$relpath = getRelativePath($a,$b);//needed function,should return '../../root/b/b.php'

Any good ideas?Thanks.

© Stack Overflow or respective owner

Related posts about php

Related posts about relative-path