If you want to take out those quotes then you’ll have to do so:
trim(nl2br($texto));
Unless at the time you are printing the variable you have done so:
<div>
<?php echo nl2br($texto); ?>
</div>
Because in this case, the line break given in the div counts as space (which generates those quotes in the firebug
).
In case, you can do so:
<div><?php echo trim(nl2br($texto)) ?></div>
I have made the following test for you to verify that my last two examples have differences:
<?php ob_start() ?>
<div>Meu nome é Wallace</div>
<?php var_dump(ob_get_clean()) ?>
<?php ob_start() ?>
<div>
Meu nome é Wallace
</div>
<?php var_dump(ob_get_clean()) ?>
The results are:
string(31) "<div>Meu nome é Wallace</div>
"
string(34) "<div>
Meu nome é Wallace
</div>
"
Note that these line breaks are processed as string content.
The first string had the quotation mark down because I had to break the line to put the var_dump(ob_get_clean())
I thought about it too, but I was wondering if it was the right way hehe
– user28595
+1 ta light eh hsausha
– Gabriel Rodrigues
I also use this form because it wouldn’t be right? @Diegofelipe
– Bia
I will make the answer more complete. Wait for the prints
– Wallace Maxters
@Bia not that it was not the correct form, out of me to affirm it. I was just wondering if it was the best way, but from Wallace’s explanations, it’s more than proven :)
– user28595
It worked, thank you.
– let