Annotation of embedaddon/php/ext/standard/tests/general_functions/var_export_basic8.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: var_export(): simple test with arrays and objects
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : mixed var_export(mixed var [, bool return])
! 6: * Description: Outputs or returns a string representation of a variable
! 7: * Source code: ext/standard/var.c
! 8: * Alias to functions:
! 9: */
! 10:
! 11: echo "\n\n-- Var export on a simple object --\n";
! 12: $o1 = new stdclass;
! 13: $o1->p = '22';
! 14: $o2 = new stdclass;
! 15: $o2->a = 1;
! 16: $o2->b = array('k'=>2);
! 17: $o2->x = $o1;
! 18: var_export($o2);
! 19:
! 20: echo "\n\n-- Var export on an simple array --\n";
! 21: $a = array(1,2,3,4);
! 22: var_export($a);
! 23:
! 24: echo "\n\n-- Var export on an nested array --\n";
! 25: $a = array('one' => 'first');
! 26: $b = array('foo' => $a, 'bar' => $o2);
! 27: var_export($b);
! 28:
! 29: ?>
! 30: ===DONE===
! 31: --EXPECTF--
! 32: -- Var export on a simple object --
! 33: stdClass::__set_state(array(
! 34: 'a' => 1,
! 35: 'b' =>
! 36: array (
! 37: 'k' => 2,
! 38: ),
! 39: 'x' =>
! 40: stdClass::__set_state(array(
! 41: 'p' => '22',
! 42: )),
! 43: ))
! 44:
! 45: -- Var export on an simple array --
! 46: array (
! 47: 0 => 1,
! 48: 1 => 2,
! 49: 2 => 3,
! 50: 3 => 4,
! 51: )
! 52:
! 53: -- Var export on an nested array --
! 54: array (
! 55: 'foo' =>
! 56: array (
! 57: 'one' => 'first',
! 58: ),
! 59: 'bar' =>
! 60: stdClass::__set_state(array(
! 61: 'a' => 1,
! 62: 'b' =>
! 63: array (
! 64: 'k' => 2,
! 65: ),
! 66: 'x' =>
! 67: stdClass::__set_state(array(
! 68: 'p' => '22',
! 69: )),
! 70: )),
! 71: )===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>