summaryrefslogtreecommitdiff
path: root/ext/standard/tests/strings/strrchr_error.phpt
blob: aa0adf4b85d3cd25f0be090b49c5f3499f6361bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
--TEST--
Test strrchr() function : error conditions 
--FILE--
<?php
/* Prototype  : string strrchr(string $haystack, string $needle);
 * Description: Finds the last occurrence of a character in a string. 
 * Source code: ext/standard/string.c
*/

echo "*** Testing strrchr() function: error conditions ***\n";
$haystack = "Hello";
$needle = "Hello";
$extra_arg = "Hello";

echo "\n-- Testing strrchr() function with Zero arguments --";
var_dump( strrchr() );

echo "\n-- Testing strrchr() function with less than expected no. of arguments --";
var_dump( strrchr($haystack) );

echo "\n-- Testing strrchr() function with more than expected no. of arguments --";
var_dump( strrchr($haystack, $needle, $extra_arg) );

echo "*** Done ***";
?>
--EXPECTF--
*** Testing strrchr() function: error conditions ***

-- Testing strrchr() function with Zero arguments --
Warning: strrchr() expects exactly 2 parameters, 0 given in %s on line %d
NULL

-- Testing strrchr() function with less than expected no. of arguments --
Warning: strrchr() expects exactly 2 parameters, 1 given in %s on line %d
NULL

-- Testing strrchr() function with more than expected no. of arguments --
Warning: strrchr() expects exactly 2 parameters, 3 given in %s on line %d
NULL
*** Done ***