phplaravelfunctionlaravel-4laravel-blade

Calling a native PHP function in Laravel 4 blade doesn't work


How can I call a native PHP function str_replace() in my Laravel 4 blade file?

I want to convert my snake_case values to space-separated words using str_replace().

I am trying this php code but it's useless.

<th>{{str_replace('_', ' ', $str)}}</th>

Solution

  • You can use php code in .blade.php file

    try like this

    <th> <?=str_replace('_', ' ', $str)?> </th>