Annotation of embedaddon/php/ext/standard/tests/array/array_walk_variation8.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test array_walk() function : usage variations - buit-in function as callback
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : bool array_walk(array $input, string $funcname [, mixed $userdata])
! 6: * Description: Apply a user function to every member of an array
! 7: * Source code: ext/standard/array.c
! 8: */
! 9:
! 10: /*
! 11: * Passing different buit-in functionns as callback function
! 12: * pow function
! 13: * min function
! 14: * echo language construct
! 15: */
! 16:
! 17: echo "*** Testing array_walk() : built-in function as callback ***\n";
! 18:
! 19: $input = array(2 => 1, 65, 98, 100, 6 => -4);
! 20:
! 21: echo "-- With 'pow' built-in function --\n";
! 22: var_dump( array_walk($input, 'pow'));
! 23:
! 24: echo "-- With 'min' built-in function --\n";
! 25: var_dump( array_walk($input, "min"));
! 26:
! 27: echo "-- With 'echo' language construct --\n";
! 28: var_dump( array_walk($input, "echo"));
! 29:
! 30: echo "Done"
! 31: ?>
! 32: --EXPECTF--
! 33: *** Testing array_walk() : built-in function as callback ***
! 34: -- With 'pow' built-in function --
! 35: bool(true)
! 36: -- With 'min' built-in function --
! 37: bool(true)
! 38: -- With 'echo' language construct --
! 39:
! 40: Warning: array_walk() expects parameter 2 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d
! 41: NULL
! 42: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>