PageRenderTime 42ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/hphp/test/zend/bad/ext/standard/tests/strings/stristr_error.php

http://github.com/facebook/hiphop-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
  1. <?php
  2. /* Prototype: string stristr ( string $haystack , mixed $needle [, bool $before_needle ] )
  3. Description: Case-insensitive strstr()
  4. */
  5. echo "*** Testing stristr() : error conditions ***\n";
  6. echo "\n-- Testing stristr() function with no arguments --\n";
  7. var_dump( stristr() );
  8. var_dump( stristr("") );
  9. echo "\n-- Testing stristr() function with no needle --\n";
  10. var_dump( stristr("Hello World") ); // without "needle"
  11. echo "\n-- Testing stristr() function with more than expected no. of arguments --\n";
  12. $extra_arg = 10;
  13. var_dump( stristr("Hello World", "World", true, $extra_arg) );
  14. echo "\n-- Testing stristr() function with empty haystack --\n";
  15. var_dump( stristr(NULL, "") );
  16. echo "\n-- Testing stristr() function with empty needle --\n";
  17. var_dump( stristr("Hello World", "") );
  18. ?>
  19. ===DONE===