PageRenderTime 25ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

/hphp/test/zend/good/ext/standard/tests/strings/strrchr_variation8.php

http://github.com/facebook/hiphop-php
PHP | 29 lines | 18 code | 3 blank | 8 comment | 0 complexity | 3d339d7414fe79e355330826c64c20e9 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. <?hh
  2. /* Prototype : string strrchr(string $haystack, string $needle);
  3. * Description: Finds the last occurrence of a character in a string.
  4. * Source code: ext/standard/string.c
  5. */
  6. /* Test strrchr() function by passing empty heredoc string for haystack
  7. * and with various needles
  8. */
  9. <<__EntryPoint>> function main(): void {
  10. echo "*** Testing strrchr() function: with heredoc strings ***\n";
  11. $empty_str = <<<EOD
  12. EOD;
  13. $needles = varray[
  14. "",
  15. '',
  16. FALSE,
  17. NULL,
  18. "\0",
  19. $empty_str //needle as haystack
  20. ];
  21. //loop through to test strrchr() with each needle
  22. foreach($needles as $needle) {
  23. var_dump( strrchr($empty_str, $needle) );
  24. }
  25. echo "*** Done ***";
  26. }