title: how to use php explode in laravel?
body: <pre><code> $user = $this-&gt;user;
              $user-&gt;name = $request['name'];
              $user-&gt;email = $request['email'];
              $user-&gt;password = $request['password'];
              $user-&gt;save();
  
  $name = explode(' ' ,$user-&gt;name);
  
  $profile= $user-&gt;userdetail()-&gt;create([
                  'user_id' =&gt; $request-&gt;input('id'),
                  'first_name' =&gt; &lt;the value of the first exploded string&gt;
  'last_name' =&gt; the value of the secondexploded string
                  ]);
  
              return redirect('confirmation');
          }
  </code></pre>
  
  <p>how to split two words using explode function in php? For example i registered wth name of JOhn doe I want to create in my userdetail table the first_name of john and last_name of doe. How can i do it/</p>