Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

othmannl's avatar

Remove NBSP

Hello, I want to remove nbsp; from the browser. But it'doesnt work

This is the line

<p class="job-card__description mt-3">{{str_limit(strip_tags($job->description), 300)}}</p>

Can you help?

0 likes
13 replies
Sinnbeck's avatar

Are they actual &nbsp; or just regular spaces?

othmannl's avatar

@Sinnbeck It shows now all the divs and removed all spaces

HalloSporters,<div><br></div><div>Zinomfitteworden?Danbenjebijmijaanhetjuisteadres.MijnnaamisAltan,21jaaren5jaaractiefbinnendefitness.Duswiljijjedoelenbehalen?danhelpikjedaargraagbij.Meerweten?neemgerustcontactop.</div><div>06-81097956</div><div><br></div><div>Metsportievegroet,&nbsp;</div><div>
Sinnbeck's avatar

@othmannl show your code or check your server log? Are you editing directly on production? Normally laravel shows a debug page

othmannl's avatar

@Sinnbeck I'm editing on production

 <p class="job-card__description mt-3">{{str_limit(preg_replace('/\s+/', '', $job->description) , 300)}}</p>
                            <div class="row mt-3">
                                <div class="col-6">
                                    <strong class="d-inline-block">@lang('Post'): {{diffForHumans($job->created_at)}}</strong>
                                </div>

Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

@othmannl seems that you just have an nbsp left

str_replace('&nbsp;', '', $job->description)
1 like

Please or to participate in this conversation.