1--TEST--
2Test strpbrk() function : error conditions
3--FILE--
4<?php
5/* Prototype  : array strpbrk(string haystack, string char_list)
6 * Description: Search a string for any of a set of characters
7 * Source code: ext/standard/string.c
8 * Alias to functions:
9 */
10
11echo "*** Testing strpbrk() : error conditions ***\n";
12
13$haystack = 'This is a Simple text.';
14$char_list = 'string_val';
15$extra_arg = 10;
16
17echo "\n-- Testing strpbrk() function with more than expected no. of arguments --\n";
18var_dump( strpbrk($haystack, $char_list, $extra_arg) );
19
20echo "\n-- Testing strpbrk() function with less than expected no. of arguments --\n";
21var_dump( strpbrk($haystack) );
22
23echo "\n-- Testing strpbrk() function with empty second argument --\n";
24var_dump( strpbrk($haystack, '') );
25
26echo "\n-- Testing strpbrk() function with arrays --\n";
27var_dump( strpbrk($haystack, array('a', 'b', 'c') ) );
28var_dump( strpbrk(array('foo', 'bar'), 'b') );
29
30?>
31===DONE===
32--EXPECTF--
33*** Testing strpbrk() : error conditions ***
34
35-- Testing strpbrk() function with more than expected no. of arguments --
36
37Warning: strpbrk() expects exactly 2 parameters, 3 given in %s on line %d
38bool(false)
39
40-- Testing strpbrk() function with less than expected no. of arguments --
41
42Warning: strpbrk() expects exactly 2 parameters, 1 given in %s on line %d
43bool(false)
44
45-- Testing strpbrk() function with empty second argument --
46
47Warning: strpbrk(): The character list cannot be empty in %s on line %d
48bool(false)
49
50-- Testing strpbrk() function with arrays --
51
52Warning: strpbrk() expects parameter 2 to be string, array given in %s on line %d
53bool(false)
54
55Warning: strpbrk() expects parameter 1 to be string, array given in %s on line %d
56bool(false)
57===DONE===
58