How to create a PHP function
<p>I was wondering how can I convert the code below into a PHP function that works.</p>

<p>Here is my original code.</p>

<pre><code>if(isset($_GET['cat'])) {
    $cat_name = strip_tags(filter_var($_GET['cat'], FILTER_SANITIZE_URL));
}
</code></pre>

<p>So far I got this for the function.</p>

<pre><code>function cat(){
    if(isset($_GET['cat'])) {
        $cat_name = strip_tags(filter_var($_GET['cat'], FILTER_SANITIZE_URL));
    }
}
</code></pre>
