ereg_replace_basic_002.phpt 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. --TEST--
  2. Test ereg_replace() function : basic functionality - a few non-matches
  3. --FILE--
  4. <?php
  5. /* Prototype : proto string ereg_replace(string pattern, string replacement, string string)
  6. * Description: Replace regular expression
  7. * Source code: ext/standard/reg.c
  8. * Alias to functions:
  9. */
  10. $replacement = 'r';
  11. var_dump(ereg_replace('A', $replacement, 'a'));
  12. var_dump(ereg_replace('[A-Z]', $replacement, '0'));
  13. var_dump(ereg_replace('(a){4}', $replacement, 'aaa'));
  14. var_dump(ereg_replace('^a', $replacement, 'ba'));
  15. var_dump(ereg_replace('b$', $replacement, 'ba'));
  16. var_dump(ereg_replace('[:alpha:]', $replacement, 'x'));
  17. echo "Done";
  18. ?>
  19. --EXPECTF--
  20. Deprecated: Function ereg_replace() is deprecated in %s on line %d
  21. string(1) "a"
  22. Deprecated: Function ereg_replace() is deprecated in %s on line %d
  23. string(1) "0"
  24. Deprecated: Function ereg_replace() is deprecated in %s on line %d
  25. string(3) "aaa"
  26. Deprecated: Function ereg_replace() is deprecated in %s on line %d
  27. string(2) "ba"
  28. Deprecated: Function ereg_replace() is deprecated in %s on line %d
  29. string(2) "ba"
  30. Deprecated: Function ereg_replace() is deprecated in %s on line %d
  31. string(1) "x"
  32. Done