Extracting Regex Array Indices in PHP : <p>I'm working on a small script that pulls two values out of a string that is URL.  You can see an example URL in the code below and I'm attempting to pull out the two-digit "i=" value and the longer "l=" value.</p>

<p>I did some extensive searching about this and all of the other questions on stack overflow seemed pretty straightforward.</p>

<p>I'm pretty sure I'm super close but ultimately I'm a python/django guy and I'm at a loss to why the following code is not working:</p>

<pre><code>$s = "http://mwo.smurfy-net.de/mechlab#i=16&amp;l=71a1896409db5818783971b72ba043f5f3a44fad";
$matches = array();
$result = preg_match('/^i=(?P&lt;iVal&gt;[0-9]+)&amp;l=(?P&lt;lVal&gt;[a-z0-9]+)$/siU', $s, $matches); 
echo $matches['iVal']; 
echo $matches['lVal'];
</code></pre>

<p>When executed I get errors about how the two array values, iVal and lVal, are undefined.</p>

<p>I'm unsure if the issue is with the code itself or my regex.  Any help would be appreciated.</p>
