constants_002.phpt 446 B

123456789101112131415161718
  1. --TEST--
  2. Defining constants with non-scalar values
  3. --FILE--
  4. <?php
  5. define('foo', new stdClass);
  6. var_dump(foo);
  7. define('foo', fopen(__FILE__, 'r'));
  8. var_dump(foo);
  9. ?>
  10. --EXPECTF--
  11. Warning: Constants may only evaluate to scalar values, arrays or resources in %s on line %d
  12. Warning: Use of undefined constant foo - assumed 'foo' (this will throw an Error in a future version of PHP) in %s on line %d
  13. string(%d) "foo"
  14. resource(%d) of type (stream)