preg_match problem in php ?

  • Thread starter Thread starter Brandon
  • Start date Start date
B

Brandon

Guest
First, here's the script.

$data = "<li title=1.00>Alchemy: <b>11</b>(Rank4279)<font color = Black>0<font color = Black></li>
<li title=1.00>Combat: <b>11</b>(Rank4279)<font color = Black>0<font color = Black></li>
<li title=24,426.96>Construction: <b>95</b>(Rank749)<font color = Green>3,818<font color = Black></li>
<li title=1.00>Cooking: <b>11</b>(Rank4279)<font color = Black>0<font color = Black></li> ";

$do = preg_match("/<b>(.*)<\/b>/", $data, $matches);

$alchemy = trim($matches[0], "</bB>");
$combat = trim($matches[1], "</bB>");
$construction = trim($matches[2], "</bB>");
$cooking = trim($matches[3], "</bB>");
$farming = trim($matches[4], "</bB>");


What I'm trying to do is get the values in between the <b></b> tags, put them into the $matches[] array, and then in the end just get the skill level into each variable. What I have so far, works for the first 1 or 2 variables, and then after that, $construction, and $cooking are empty.

Any help would be really appreciated.
 
Back
Top