Handle string

0

I have a string like this:

$string = "<div class="legenda">Legenda</div>
    <li><a href="link2">02</a></li>
    <li><a href="link3">03</a></li>
    <li><a href="link4">04</a></li>
    <div class="dublado">Dublado</div>
    <li><a href="link1">01</a></li>
    <li><a href="link2">02</a></li>
    <li><a href="link3">03</a></li>
";

I wanted some help to manipulate and it would be shown that way

Legenda
1
1
1
Dublado
1
1
1

In the case, show only what is inside <div class="legenda"> of <a> and other div .

Does anyone have a solution?

    
asked by anonymous 25.05.2018 / 00:31

1 answer

0

See if this helps:

CSS:

.legenda, li, .dublado {
  display: inline-block;
}

a {
  text-decoration: none;
}

PHP

<?php

$string = '<div class="legenda">Legenda</div>
<li><a href="link2">02</a></li>
<li><a href="link3">03</a></li>
<li><a href="link4">04</a></li>
<div class="dublado">Dublado</div>
<li><a href="link1">01</a></li>
<li><a href="link2">02</a></li>
<li><a href="link3">03</a></li>
';
    
25.05.2018 / 00:37