Write a PHP script to replace the first 'the' of the following string with 'That'

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

Write a PHP script to replace the first 'the' of the following string with 'That'.

Sample date: 'the quick brown fox jumps over the lazy dog.'

الأجوبة

<?php
$str = 'the quick brown fox jumps over the lazy dog.';
echo preg_replace('/the/', 'That', $str, 1)."\n"; 
?>

Sample Output:

That quick brown fox jumps over the lazy dog.
هل كان المحتوى مفيد؟

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

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