1--TEST--
2Test strrpos() function : usage variations - checking bianry safe with 'needle' argument
3--FILE--
4<?php
5/* Test strrpos() function with null terminated strings for 'needle' argument
6 *  in order to check binary safe
7*/
8
9echo "*** Test strrpos() function: binary safe ***\n";
10$haystack = "\0Hello\0World\0";
11
12$needles = array(
13  "Hello".chr(0)."World",
14  chr(0)."Hello\0",
15  chr(0),
16  "Hello\0world",
17  "\0Hello\0world\0",
18  "\0Hello",
19  "Hello\0"
20);
21
22for($index = 0; $index < count($needles); $index++ ) {
23  var_dump( strrpos($haystack, $needles[$index]) );
24  var_dump( strrpos($haystack, $needles[$index], $index) );
25}
26echo "*** Done ***";
27?>
28--EXPECT--
29*** Test strrpos() function: binary safe ***
30int(1)
31int(1)
32int(0)
33bool(false)
34int(12)
35int(12)
36bool(false)
37bool(false)
38bool(false)
39bool(false)
40int(0)
41bool(false)
42int(1)
43bool(false)
44*** Done ***
45