TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   Regex - value return (http://www.talkphp.com/general/2421-regex-value-return.html)

TlcAndres 03-04-2008 09:13 PM

Regex - value return
 
PHP Code:

$regex ='/<span id="maplat">(.*?)<\\/span><\\/label> | <label><span id="maplong">(.*?)<\\/span>/Us';
preg_match($regex,$result,$matche);
print_r($matche); 

Maybe I'm mistaken but I though for each (.*?) the value was returned into the matches array - it's returning 2 identical values which come from <spam id="maplong">(.*?)<\\/span>, Some help :)

Hopefully I'm just missing something terribly obvious.

Wildhoney 03-04-2008 09:40 PM

They'll quite often all fall into the second index in the $matche array. So like:

php Code:
$matche[1][0];
$matche[1][1];
$matche[1][2];

TlcAndres 03-04-2008 09:52 PM

Well I'm getting this return

PHP Code:

Array ( [0] => -80.19  [1] => [2] => -80.19 



All times are GMT. The time now is 06:00 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0