Return to stripos_variation4.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / strings |
1.1 misho 1: --TEST-- 2: Test stripos() function : usage variations - heredoc string containing special chars for 'haystack' argument 3: --FILE-- 4: <?php 5: /* Prototype : int stripos ( string $haystack, string $needle [, int $offset] ); 6: * Description: Find position of first occurrence of a case-insensitive string 7: * Source code: ext/standard/string.c 8: */ 9: 10: /* Test stripos() function by passing heredoc string containing special chars for haystack 11: * and with various needles & offets 12: */ 13: 14: echo "*** Testing stripos() function: with heredoc strings ***\n"; 15: echo "-- With heredoc string containing special chars --\n"; 16: $special_chars_str = <<<EOD 17: Ex'ple of h'doc st'g, contains 18: $#%^*&*_("_")!#@@!$#$^^&$*(special) 19: chars. 20: EOD; 21: var_dump( stripos($special_chars_str, "Ex'ple", 0) ); 22: var_dump( stripos($special_chars_str, "!@@!", 23) ); 23: var_dump( stripos($special_chars_str, '_') ); 24: var_dump( stripos($special_chars_str, '("_")') ); 25: var_dump( stripos($special_chars_str, "$*") ); 26: var_dump( stripos($special_chars_str, "$*", 10) ); 27: var_dump( stripos($special_chars_str, "(special)") ); 28: 29: echo "*** Done ***"; 30: ?> 31: --EXPECTF-- 32: *** Testing stripos() function: with heredoc strings *** 33: -- With heredoc string containing special chars -- 34: int(0) 35: bool(false) 36: int(38) 37: int(39) 38: int(55) 39: int(55) 40: int(57) 41: *** Done ***