- var_dump: documentation ( source)
- fwrite: documentation ( source)
- fseek: documentation ( source)
- tmpfile: documentation ( source)
<?php
$pdo = new PDO('sqlite::memory:');
$pdo->exec('CREATE TABLE test (a INTEGER, b BLOB);');
$fp = tmpfile();
fwrite($fp, 'Random stuff!');
fseek($fp, 0);
$stmt = $pdo->prepare('INSERT INTO test VALUES (?, ?);');
$stmt->bindValue(1, 42);
$stmt->bindParam(2, $fp, PDO::PARAM_LOB);
$stmt->execute();
var_dump(gettype($fp));