1
I am creating a PHP function that receives a string
. Then he must search within that string
, words inside square brackets and save them in an array.
Is there a function that searches only these words and saves them in an array? Or a variable so that I pass it to an array?
String example:
<font color="maroon">[como]</font> <rel> <ks> <font color="blue"><b>ADV</b> </font> <font color="darkgreen">@ADVL></font> <font color="darkgreen"><b>@#FS-ADVL</font></b> <font color="darkgreen"><b>@#FS-N<</font></b>
<dt><b><font color="maroon">não</font></b>
<font color="maroon">[não]</font> <font color="blue"><b>ADV</b> </font> <font color="darkgreen">@ADVL></font>
<dt><b><font color="maroon">amar</font></b>
<font color="maroon">[amar]</font> <vt> <font color="blue"><b>V</b> FUT 1/3S SUBJ VFIN </font> <font color="darkgreen">@FMV</font>
<dt><b><font color="maroon">uma</font></b>
<font color="maroon">[um]</font> <arti> <font color="blue"><b>DET</b> F S </font> <font color="darkgreen">@>N</font>
<dt><b><font color="maroon">pessoa</font></b>
<font color="maroon">[pessoa]</font> <H> <font color="blue"><b>N</b> F S </font> <font color="darkgreen">@<ACC</font>
<dt><b><font color="maroon">tão</font></b>
<font color="maroon">[tão]</font> <dem> <quant> <font color="blue"><b>ADV</b> </font> <font color="darkgreen">@>A</font>
<dt><b><font color="maroon">linda</font></b>
<font color="maroon">[lindo]</font> <font color="blue"><b>ADJ</b> F S </font> <font color="darkgreen">@N<</font>
<dt><b><font color="maroon">.</font></b>
example of the array
Array
(
[0] => como
[1] => não
[2] => amar
[3] => um
[5] => pessoa
[6] => tão
[7] => lindo
)