Blade is echoing 1

164 Views Asked by At

I am trying to echo result of a function using blade {!! !!}

Using like this {!! !!} It shows the value that I need besides of showing 1 I have var dumped the function doing like this

{!! var_dump(ma_fonction)!!}

It shows me the result and after it , it shows bool(true)

Does anyone has an idea about this?

Thanks in advance

2

There are 2 best solutions below

1
Amstroke On

its because of default behaviour of var_dump function. learn more here.

you could also consider var_export

0
Maik Lowrey On

Very likely your function returns an array. And probably the last field in the array is a key => bool. For exapmple:

array(5) { ["description"]=> string(6) "<b>a</b>" ["isSomething"]=> string(4) "true" }

If you want print the description the use:

@php $data = ma_function(); @endphp
{!! $data['description'] !!}