Array to string conversion laravel blade

You can covert array to string in laravel blade. You can use implode() method on array in @php directive to display array as a string

Answers 1
  • Array to string conversion laravel blade

    --PATH resources\views\<home>.blade.php
    @php 
        $array = array('This','is','a','string');   
        $string = implode(" ",$array); 
        echo $string; 
    @endphp
    
    //Output :
    This is a string
    
    0

    You can convert an array to string using implode method in laravel view.

  • Back to code snippet queries related laravel