0
I got the string :
$textMostraMarcado = '3 3 1 6 8 6 8 <b>1 1 1 </b>2 4 2 7 5 <b>4 4 4 4 </b>9 <b>8 8 8 </b>7'
I would like the result:
<b>1 1 1 </b>
<b>4 4 4 4 </b>
<b>8 8 8 </b>
That is, get the values that are between the tags <b></b>.
0
I got the string :
$textMostraMarcado = '3 3 1 6 8 6 8 <b>1 1 1 </b>2 4 2 7 5 <b>4 4 4 4 </b>9 <b>8 8 8 </b>7'
I would like the result:
<b>1 1 1 </b>
<b>4 4 4 4 </b>
<b>8 8 8 </b>
That is, get the values that are between the tags <b></b>.
3
Just use expressions with the function preg_match_all:
/<b>.*?<\/b>/;For example:
if (preg_match_all("/<b>.*?<\/b>/", $textMostraMarcado, $matches))
{
print_r($matches[0]);
}
The exit will be:
Array
(
[0] => <b>1 1 1 </b>
[1] => <b>4 4 4 4 </b>
[2] => <b>8 8 8 </b>
)
See working on Ideone.
Browser other questions tagged php
You are not signed in. Login or sign up in order to post.
Can you describe in words what that result would be? You want to take the content that is between the tags
<b></b>?– Woss
Exactly that, get the sequences in bold. Thank you
– Pedro