HomePHP Write a PHP script to get the first word of a sentence Vikram somai September 23, 2021 0 Comments Facebook Twitter 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 Tags PHP Facebook Twitter
Post a Comment
If you have any doubts, Please let me know
Thanks!