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

  • برمجة بي اتش بي

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

Original String : 'The quick brown fox'

الأجوبة

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

Sample Output:

The
هل كان المحتوى مفيد؟

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...