Escape quotes in a variable with PHP
<p>I use this code to genefate html</p>

<pre><code>echo "&lt;input type='button' onclick=\"myFunc('$param');\" /&gt;";
</code></pre>

<p>Everything would be OK unless $param contains <code>'</code> or <code>"</code> character. How should it be implemented to handle these situations?</p>

<p>ps. mysql_real_escape_string($param) won't work correctly, when a user entered <code>"</code>.</p>
