- var_dump: documentation ( source)
- str_replace: documentation ( source)
- addcslashes: documentation ( source)
- mb_internal_encoding: documentation ( source)
<?php
function escapeShellArgument( $argument )
{
$escapeChar = '"';
$argument = str_replace( $escapeChar, "\\" . $escapeChar, addcslashes( $argument, '\\' ) );
var_dump($escapeChar . $argument . $escapeChar);
}
var_dump(mb_internal_encoding("BIG5"));
escapeShellArgument("0ノルウェーサーモンのカルパッチョ");
escapeShellArgument("'00サーモンを薄切りにし、お\"皿に均等に並べ、塩、コショウを軽く振っておきます。");
escapeShellArgument("\"this should work!\"");