1--TEST--
2Test strrchr() function : error conditions
3--FILE--
4<?php
5/* Prototype  : string strrchr(string $haystack, string $needle);
6 * Description: Finds the last occurrence of a character in a string.
7 * Source code: ext/standard/string.c
8*/
9
10echo "*** Testing strrchr() function: error conditions ***\n";
11$haystack = "Hello";
12$needle = "Hello";
13$extra_arg = "Hello";
14
15echo "\n-- Testing strrchr() function with Zero arguments --";
16var_dump( strrchr() );
17
18echo "\n-- Testing strrchr() function with less than expected no. of arguments --";
19var_dump( strrchr($haystack) );
20
21echo "\n-- Testing strrchr() function with more than expected no. of arguments --";
22var_dump( strrchr($haystack, $needle, $extra_arg) );
23
24echo "*** Done ***";
25?>
26--EXPECTF--
27*** Testing strrchr() function: error conditions ***
28
29-- Testing strrchr() function with Zero arguments --
30Warning: strrchr() expects exactly 2 parameters, 0 given in %s on line %d
31NULL
32
33-- Testing strrchr() function with less than expected no. of arguments --
34Warning: strrchr() expects exactly 2 parameters, 1 given in %s on line %d
35NULL
36
37-- Testing strrchr() function with more than expected no. of arguments --
38Warning: strrchr() expects exactly 2 parameters, 3 given in %s on line %d
39NULL
40*** Done ***
41