Get comma separated email from input array

You can get a comma-separated email from the input array in the laravel controller. You have to pass the $request->email to implode method inside your controller's method in laravel.

Answers 1
  • Input array to comma separated string conversion in laravel controller

    <form action="{{ route('store') }}" method="post">
        <input type="text" name="email[]"/>
        <input type="text" name="email[]"/>
        <button type="submit"> Submit </button>
    public function inputArrayToString(Request $request){
        $string = implode(',', $request->email);
        echo $string;
        //perform task after converting input array to string

    This code snippet is used to convert the input array to a comma-separated string using the controller method. Create routes in web.php and change the routes name as per your requirement.

  • Back to code snippet queries related laravel