PageRenderTime 50ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/2.0/Tests/Variables/serialize.php

#
PHP | 31 lines | 14 code | 8 blank | 9 comment | 3 complexity | d179e4f6a55d7187b5adbcab189e0c8a MD5 | raw file
Possible License(s): CPL-1.0, GPL-2.0, CC-BY-SA-3.0, MPL-2.0-no-copyleft-exception, Apache-2.0
  1. [expect php]
  2. [file]
  3. <?
  4. $a = array(NULL, FALSE, TRUE, 0, 123456, "", "Master Yoda",
  5. array(), array(1, 2, 3, ""), new stdClass());
  6. echo serialize($a) . "\n";
  7. $b = unserialize(serialize($a));
  8. if ($a == $b) echo "OK1\n";
  9. $x = serialize(new stdClass);
  10. $x = str_replace("std", "XYZ", $x);
  11. $y = unserialize($x);
  12. if ($y instanceOf __PHP_Incomplete_Class) echo "OK2\n";
  13. echo serialize($y);
  14. /* $b = array();
  15. $b[] =& $b;
  16. $a[] = $b;
  17. $b = array();
  18. $b[0] = 123;
  19. var_dump($a);*/
  20. ?>