Annotation of embedaddon/php/ext/filter/tests/037.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: GET and data callback tests
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded("filter")) die("skip"); ?>
! 5: --GET--
! 6: a=1&b=2
! 7: --FILE--
! 8: <?php
! 9: function myfunc($val) {
! 10: return $val . '_callback';
! 11: }
! 12: echo filter_input(INPUT_GET, 'a', FILTER_CALLBACK, array("options"=>'myfunc'));
! 13: echo "\n";
! 14: echo filter_input(INPUT_GET, 'b', FILTER_VALIDATE_INT);
! 15: echo "\n";
! 16: $data = "data";
! 17:
! 18: echo filter_var($data, FILTER_CALLBACK, array("options"=>'myfunc'));
! 19: echo "\n";
! 20:
! 21: $res = filter_input_array(INPUT_GET, array(
! 22: 'a' => array(
! 23: 'filter' => FILTER_CALLBACK,
! 24: 'options' => 'myfunc'
! 25: ),
! 26: 'b' => FILTER_VALIDATE_INT
! 27: )
! 28: );
! 29:
! 30: var_dump($res);
! 31: ?>
! 32: --EXPECT--
! 33: 1_callback
! 34: 2
! 35: data_callback
! 36: array(2) {
! 37: ["a"]=>
! 38: string(10) "1_callback"
! 39: ["b"]=>
! 40: int(2)
! 41: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>