× {{alert.msg}} Never ask again
Get notified about new tutorials RECEIVE NEW TUTORIALS

Functions within a function.

<p>In this session. Nicholas had a re-occurring error within his form process. But instead of creating a new function to handle three in-built PHP functions, you can always wrap a function within another function. In the case, here's the snippet below.</p> <p>Effective and with less code.</p> <pre><code class="language-php">$first_name = htmlspecialchars(stripslashes(trim($_POST["first_name"]))); $last_name = htmlspecialchars(stripslashes(trim($_POST["last_name"]))); $username = htmlspecialchars(stripslashes(trim($_POST["username"]))); $password = htmlspecialchars(stripslashes(trim($_POST["password"]))); $email = htmlspecialchars(stripslashes(trim($_POST["email"]))); </code></pre> <p>In the code snippet, we can clearly see the trim method called within the stripslashes and htmlspecialchars method sort holding it all together. Please note that the order does not matter.</p>
comments powered by Disqus