<?php
$info = new SplFileInfo('php://temp');
$obj = new SplFileObject('php://memory');
$tmp = new SplTempFileObject;
if ($obj instanceof SplFileInfo) {
echo 'SplFileObject is an instanceof SplFileInfo', PHP_EOL;
} else {
echo 'SplFileObject is not an instanceof SplFileInfo', PHP_EOL;
}
if ($tmp instanceof SplFileObject) {
echo 'SplFileObject is an instanceof SplFileInfo', PHP_EOL;
} else {
echo 'SplFileObject is not an instanceof SplFileInfo', PHP_EOL;
}
if ($tmp instanceof SplFileInfo) {
echo 'SplTempFileObject is an instanceof SplFileInfo', PHP_EOL;
} else {
echo 'SplTempFileObject is not an instanceof SplFileInfo', PHP_EOL;
}
SplFileObject is an instanceof SplFileInfo
SplFileObject is an instanceof SplFileInfo
SplTempFileObject is an instanceof SplFileInfo
Output for 5.1.2 - 5.1.3
Fatal error: Uncaught exception 'RuntimeException' with message 'SplFileObject::__construct(php://memory): failed to open stream: Inappropriate ioctl for device' in /in/o0IFg:4
Stack trace:
#0 /in/o0IFg(4): SplFileObject->__construct('php://memory')
#1 {main}
thrown in /in/o0IFg on line 4
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.1
Fatal error: Class 'SplFileInfo' not found in /in/o0IFg on line 3
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING in /in/o0IFg on line 7
Process exited with code 255.