How to Remove HTML Tags From String in Laravel?

In this example, I will show you php remove html tags from string. In this quick example, you will see how to remove html tags from string in php laravel. We can remove all HTML tags from the string using the strip_tags() function of PHP. I will give you a simple example code for how to remove HTML tags from strings in php laravel application.

If you do not know which function is used to remove all html tags from a string in php laravel then this example is for you. Let's see the example of laravel remove html tags from string example.

app/Http/Controllers/DemoController.php

namespace App\Http\Controllers;
    
use Illuminate\Http\Request;
     
class DemoController extends Controller
{
    /**
     * Write code on Method
     *
     * @return response()
     */
    public function index(Request $request)
    {
        $tagsString = "Your string with html";
  
        return view("demo", compact("tagsString"));
    }
}

 

Now print it in blade file like:

views/demo.blade.php

 

Read also: Laravel Check If Relationship Is Empty Or Not Example

 

Hope it can help you.

 

author-image
Facebook Github
A web enthusiastic, a self-motivated full-stack software engineer from Dhaka, Bangladesh with experience in developing applications using Laravel , React and Vue js