/hphp/test/zend/bad/ext/standard/tests/strings/stristr_error.php
PHP | 26 lines | 16 code | 7 blank | 3 comment | 0 complexity | a15120ea9ce8cc35924a92f894efba54 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-2-Clause, BSD-3-Clause, MPL-2.0-no-copyleft-exception, MIT, LGPL-2.0, Apache-2.0
- <?php
- /* Prototype: string stristr ( string $haystack , mixed $needle [, bool $before_needle ] )
- Description: Case-insensitive strstr()
- */
- echo "*** Testing stristr() : error conditions ***\n";
- echo "\n-- Testing stristr() function with no arguments --\n";
- var_dump( stristr() );
- var_dump( stristr("") );
- echo "\n-- Testing stristr() function with no needle --\n";
- var_dump( stristr("Hello World") ); // without "needle"
- echo "\n-- Testing stristr() function with more than expected no. of arguments --\n";
- $extra_arg = 10;
- var_dump( stristr("Hello World", "World", true, $extra_arg) );
- echo "\n-- Testing stristr() function with empty haystack --\n";
- var_dump( stristr(NULL, "") );
- echo "\n-- Testing stristr() function with empty needle --\n";
- var_dump( stristr("Hello World", "") );
- ?>
- ===DONE===