<?php
$domd=new DOMDocument();
$str = "DOMDocument";
var_dump($domd instanceof $str);
var_dump($domd instanceof ("DOMDocument"));
// ^ is legal.
// V is illegal
// var_dump($domd instanceof "DOMDocument");
$code = '
var_dump($domd instanceof "DOMDocument");
';
eval($code);
// the eval hack is for illustration, make it an error at run-time, rather than compile-time.
bool(true)
bool(true)
Parse error: syntax error, unexpected double-quoted string "DOMDocument" in /in/EMRub(13) : eval()'d code on line 2
Process exited with code 255.