title: In PHP, after assigning a file pointer resource to a variable with fopen(), how can I get the file name from the variable?
body: <p>For example:</p>
  
  <pre><code>$file = fopen("File.txt", "r");
  $filename = $file-&gt;basename;
  </code></pre>
  
  <p>if there was a method like basename for file objects (file pointer resources).</p>