title: file_exists() returns false when using path with ~, tilde in it
body: <p>So I have the following path: <code>/my_user/path/to/dir</code>, and when I pass it to <code>file_exists()</code>, it works fine.</p>
  
  <p>However, when I change it to <code>~username/path/to/dir</code>, it returns false.</p>
  
  <p><code>realpath("~username/path/to/dir")</code> returns false as well.</p>
  
  <p>What can be wrong?</p>
  
  <p><strong>Note:</strong> This is not a duplicate of <a href="https://stackoverflow.com/questions/1894917/how-to-get-the-home-directory-from-a-php-cli-script">How to get the home directory from a PHP CLI script?</a> because I'm more curious about why the tilde doesn't work, rather than how to work around it.</p>