Query: escapeshellarg
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
ESCAPESHELLARG(3) 1 ESCAPESHELLARG(3) escapeshellarg - Escape a string to be used as a shell argumentSYNOPSISstring escapeshellarg (string $arg)DESCRIPTIONescapeshellarg(3) adds single quotes around a string and quotes/escapes any existing single quotes allowing you to pass a string directly to a shell function and having it be treated as a single safe argument. This function should be used to escape individual arguments to shell functions coming from user input. The shell functions include exec(3), system(3) and the backtick operator. On Windows, escapeshellarg(3) instead removes percent signs, replaces double quotes with spaces and adds double quotes around the string.PARAMETERSo $arg - The argument that will be escaped.RETURN VALUESThe escaped string.EXAMPLESExample #1 escapeshellarg(3) example <?php system('ls '.escapeshellarg($dir)); ?>SEE ALSOescapeshellcmd(3), exec(3), popen(3), system(3), backtick operator. PHP Documentation Group ESCAPESHELLARG(3)