overload02.phpt 929 B

123456789101112131415161718192021222324252627282930313233343536
  1. --TEST--
  2. Function overloading test 2
  3. --SKIPIF--
  4. <?php
  5. extension_loaded('mbstring') or die('skip mbstring not available');
  6. if (!function_exists("mail")) {
  7. die('skip mail() function is not available.');
  8. }
  9. if (!function_exists("mb_ereg_replace")) {
  10. die('skip mb_ereg_replace() function is not available.');
  11. }
  12. ?>
  13. --INI--
  14. output_handler=
  15. mbstring.func_overload=7
  16. mbstring.internal_encoding=EUC-JP
  17. --FILE--
  18. <?php
  19. echo mb_internal_encoding()."\n";
  20. $ngchars = array('能','表','蚕','ソ');
  21. $str = '元禄養蚕會社詐欺表現能力表示噂免停暴力貼付構文圭子予知饅頭ソファー';
  22. $converted_str = mb_convert_encoding($str, 'Shift_JIS');
  23. mb_regex_encoding('Shift_JIS');
  24. foreach($ngchars as $c) {
  25. $c = mb_convert_encoding($c, 'Shift_JIS');
  26. $replaced = mb_convert_encoding(ereg_replace($c, '!!', $converted_str), mb_internal_encoding(), 'Shift_JIS');
  27. var_dump(strpos($replaced, '!!'));
  28. }
  29. ?>
  30. --EXPECT--
  31. EUC-JP
  32. int(10)
  33. int(8)
  34. int(3)
  35. int(29)