title: How to get the home directory from a PHP CLI script?
body: <p>From the command line, I can get the home directory like this:</p>
  
  <pre><code>~/
  </code></pre>
  
  <p>How can I get the home directory inside my PHP CLI script?</p>
  
  <pre><code>#!/usr/bin/php
  &lt;?php
  echo realpath(~/);
  ?&gt;
  </code></pre>