<p>Exactly as the question states: How can you check if a variable in PHP contains a file pointer? Some like <code>is_string()</code> or <code>is_object()</code>.</p>

You can use
```
stream_get_meta_data()
```
for this.
```
```
<?php
$f = fopen('index.php', 'r');
var_dump(stream_get_meta_data($f));
?>

array
  'wrapper_type' => string 'plainfile' (length=9)
  'stream_type' => string 'STDIO' (length=5)
  'mode' => string 'r' (length=1)
  'unread_bytes' => int 0
  'seekable' => boolean true
  'uri' => string 'index.php' (length=9)
  'timed_out' => boolean false
  'blocked' => boolean true
  'eof' => boolean false
```
```
You can prefix it with @ to supress warnings if the variable is not a resource - then just check if it returned false.