PageRenderTime 142ms CodeModel.GetById 24ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://github.com/facebook/hiphop-php
PHP | 31 lines | 19 code | 4 blank | 8 comment | 0 complexity | 5ebaab85cb5bb252dbdc32229eed37fd 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 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 heredoc string containing quote chars for haystack
  7. * and with various needles
  8. */
  9. echo "*** Testing strrchr() function: with heredoc strings ***\n";
  10. $quote_char_str = <<<EOD
  11. "things" "in" "double" "quote"
  12. 'things' 'in' 'single' 'quote'
  13. EOD;
  14. $needles = array(
  15. "things",
  16. "\"things\"",
  17. "\'things\'",
  18. "in",
  19. "quote",
  20. $quote_char_str //needle as haystack
  21. );
  22. //loop through to test strrchr() with each needle
  23. foreach($needles as $needle) {
  24. var_dump( strrchr($quote_char_str, $needle) );
  25. }
  26. echo "*** Done ***";
  27. ?>