Search code examples
phplaravellaravel-blade

Positive value into .blade.php {{}}


I am trying to print a positive value into blade.php with the code {{$data['short_sell_profit_loss'] }

$short_sell_profit_loss = "-15,000"

its give me an error:

htmlspecialchars() expects parameter 1 to be string, array given


Solution

  • {{}} uses PHP htmlspecialchars() which needs string to be it's parameter.

    The error indicates that $data['short_sell_profit_loss'] is an array

    You can try putting this code before returning view in controller to get an idea what kind of value is stored in that variable.

    dd($data['short_sell_profit_loss']);