title: Getting relative path from absolute path in PHP
body: <p>I noticed 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?</p>
  
  <p>To be specified.</p>
  
  <pre><code>$a="/home/apache/a/a.php";
  $b="/home/root/b/b.php";
  $relpath = getRelativePath($a,$b); //needed function,should return '../../root/b/b.php'
  </code></pre>
  
  <p>Any good ideas? Thanks.</p>