1

Im trying to get the text inbetween a tag. Heres what I have so far:

$new4 = '><strong> Rating:</strong><span> <span class="rl s5" title="A 5 Star(s)">A';

preg_match('/title="(.*?)">">/', $new4, $output);
echo '<pre>';
print_r($output);
echo '</pre>';

All im getting is a blank array, not sure where I am going wrong.

Adam
  • 455
  • 1
  • 3
  • 18
  • 2
    You don't have `">/', $new4, $output)) { print_r($output); } else { echo 'no matches :(';}` – chris85 May 22 '15 at 23:22
  • Okay, with your update you don't have `">">` in `$new4`. You have answer below that should work for the provided example. If there is more to your question please post the requirements. – chris85 May 22 '15 at 23:28

1 Answers1

1

Try this:

preg_match('/title="(.*?)"/', $new4, $output);
Michal Przybylowicz
  • 1,558
  • 3
  • 16
  • 22