Annotation of embedaddon/php/ext/standard/tests/array/array_diff_uassoc_variation12.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test array_diff_uassoc() function : usage variation - Passing null,unset and undefined variable indexed array
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : array array_diff_uassoc(array arr1, array arr2 [, array ...], callback key_comp_func)
! 6: * Description: Computes the difference of arrays with additional index check which is performed by a
! 7: * user supplied callback function
! 8: * Source code: ext/standard/array.c
! 9: */
! 10:
! 11: echo "*** Testing array_diff_uassoc() : usage variation ***\n";
! 12:
! 13: // Initialise function arguments not being substituted (if any)
! 14: $input_array = array(10 => '10', "" => '');
! 15:
! 16: //get an unset variable
! 17: $unset_var = 10;
! 18: unset ($unset_var);
! 19:
! 20: $input_arrays = array(
! 21: 'null indexed' => array(NULL => NULL, null => null),
! 22: 'undefined indexed' => array(@$undefined_var => @$undefined_var),
! 23: 'unset indexed' => array(@$unset_var => @$unset_var),
! 24: );
! 25:
! 26: foreach($input_arrays as $key =>$value) {
! 27: echo "\n--$key--\n";
! 28: var_dump( array_diff_uassoc($input_array, $value, "strcasecmp") );
! 29: var_dump( array_diff_uassoc($value, $input_array, "strcasecmp") );
! 30: }
! 31:
! 32: ?>
! 33: ===DONE===
! 34: --EXPECTF--
! 35: *** Testing array_diff_uassoc() : usage variation ***
! 36:
! 37: --null indexed--
! 38: array(1) {
! 39: [10]=>
! 40: string(2) "10"
! 41: }
! 42: array(0) {
! 43: }
! 44:
! 45: --undefined indexed--
! 46: array(1) {
! 47: [10]=>
! 48: string(2) "10"
! 49: }
! 50: array(0) {
! 51: }
! 52:
! 53: --unset indexed--
! 54: array(1) {
! 55: [10]=>
! 56: string(2) "10"
! 57: }
! 58: array(0) {
! 59: }
! 60: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>