explode():-

The explode() function breaks a string into an array.

code:-

<?php
$str = 'james bond';
$arr = explode(' ',trim($str));
echo $arr[0]."\n";
?>

output:-

james

Post a Comment

If you have any doubts, Please let me know
Thanks!

Previous Post Next Post