1--TEST-- 2mb_substitute_character() 3--SKIPIF-- 4<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?> 5--FILE-- 6<?php 7 8// Note: It does not return TRUE/FALSE for setting char 9 10var_dump(mb_substitute_character(0x3044)); 11var_dump(mb_substitute_character()); 12var_dump(bin2hex(mb_convert_encoding("\xe2\x99\xa0\xe3\x81\x82", "CP932", "UTF-8"))); 13 14var_dump(mb_substitute_character('long')); 15var_dump(mb_substitute_character()); 16var_dump(bin2hex(mb_convert_encoding("\xe2\x99\xa0\xe3\x81\x82", "CP932", "UTF-8"))); 17 18var_dump(mb_substitute_character('none')); 19var_dump(mb_substitute_character()); 20var_dump(bin2hex(mb_convert_encoding("\xe2\x99\xa0\xe3\x81\x82", "CP932", "UTF-8"))); 21 22var_dump(mb_substitute_character('entity')); 23var_dump(mb_substitute_character()); 24var_dump(bin2hex(mb_convert_encoding("\xe2\x99\xa0\xe3\x81\x82", "CP932", "UTF-8"))); 25 26try { 27 var_dump(mb_substitute_character('BAD_NAME')); 28} catch (\ValueError $e) { 29 echo $e->getMessage() . \PHP_EOL; 30} 31?> 32--EXPECT-- 33bool(true) 34int(12356) 35string(8) "82a282a0" 36bool(true) 37string(4) "long" 38string(16) "552b3236363082a0" 39bool(true) 40string(4) "none" 41string(4) "82a0" 42bool(true) 43string(6) "entity" 44string(20) "262378323636303b82a0" 45mb_substitute_character(): Argument #1 ($substitute_character) must be "none", "long", "entity" or a valid codepoint 46