Skip to content

Instantly share code, notes, and snippets.

@fetus-hina
Created November 29, 2011 11:22
Show Gist options
  • Save fetus-hina/1404467 to your computer and use it in GitHub Desktop.
Save fetus-hina/1404467 to your computer and use it in GitHub Desktop.
mb_str_replace() 説明ページ用互換性注意事項
<?php
$subject = 'hogefuga';
$table = array('hoge' => 'foo',
'fuga' => 'bar',
'piyo' => 'baz',
'foo' => '***',
'bar' => '+++',
'baz' => '---');
$functions = array('str_replace', 'mb_str_replace');
foreach($functions as $f) {
$result = $f(array_keys($table), array_values($table), $subject);
printf("%s: %s\n", $f, $result);
}
str_replace: ***+++
mb_str_replace: foobar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment