Q:

Write a PHP script to get the first word of a sentence

0

Write a PHP script to get the first word of a sentence.

Original String : 'The quick brown fox'

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

<?php
$s = 'The quick brown fox';
$arr1 = explode(' ',trim($s));
echo $arr1[0]."\n";
?>

Sample Output:

The

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now