- mb_convert_encoding: documentation ( source)
- var_dump: documentation ( source)
- mb_regex_encoding: documentation ( source)
- mb_ereg_replace: documentation ( source)
<?php
mb_regex_encoding('SJIS');
$string = mb_convert_encoding("hello ここに文を入れる。", "SJIS", "UTF-8");
$pattern = "hello";
$replacement = 'hi';
//expected result: hi ここに文を入れる。
//but it returns NULL
$output = mb_ereg_replace($pattern, $replacement, $string);
var_dump(mb_convert_encoding($output, "UTF-8", "SJIS"));