PHP codes works in ver. 5.2, not in 5.3
<p>Is there any way to rewrite the following code so that it works in an environment running PHP version 5.2.x? It works just fine running in version 5.3.5 (dev), but my shared hosting environment (prod) runs 5.2 and throws this error:</p>

<blockquote>
  <p>Parse error: syntax error, unexpected T_FUNCTION in /home/myperf7/ public_html/inc/store-address.php on line 1</p>
</blockquote>

<p>Here's the offending code:</p>

<pre><code>&lt;?php

function storeAddress(){

    // Validation
    if(!$_GET['email']){ return "No email address provided"; } 

    if(!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$/i", $_GET['email'])) {
        return "Email address is invalid"; 
    }

    require_once('MCAPI.class.php');
    // grab an API Key from http://admin.mailchimp.com/account/api/
    $api = new MCAPI('XXXXXXX');

    // grab your List's Unique Id by going to http://admin.mailchimp.com/lists/
    // Click the "settings" link for the list - the Unique Id is at the bottom of that page. 
    $list_id = "XXXXXXX";

    if($api-&gt;listSubscribe($list_id, $_GET['email'], '') === true) {
        // It worked!   
        return 'Success! Check your email to confirm sign up.';
    }else{
        // An error ocurred, return error message   
        return 'Error: ' . $api-&gt;errorMessage;
    }

}

// If being called via ajax, autorun the function
if(isset($_GET['ajax'])){ echo storeAddress(); }

?&gt;
</code></pre>

<p>And this is how the store-address.php file is being included from my index.php page:</p>

<pre><code>&lt;form id="signup" action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;" method="get"&gt;
    &lt;input type="text" value="" name="email" class="email" id="email" placeholder="email address" required="required" /&gt;
    &lt;div class="clear"&gt;
        &lt;input type="submit" value="Notify me" name="subscribe" class="button"/&gt;
    &lt;/div&gt;
    &lt;span id="response"&gt;&lt;?php require_once('inc/store-address.php'); if(isset($_GET['submit'])){ echo storeAddress(); } ?&gt;&lt;/span&gt;
&lt;/form&gt;
</code></pre>

<p>Thanks so so so so much!</p>
