لغة PHP — الصفحة ٢١٣

متنوعات /* These two examples replace all of $var with 'bob'. */ echo substr_replace ($var, 'bob', 0). "<br>\n"; echo substr_replace ($var, 'bob', 0, strlen ($var)). "<br>\n"; /* Insert 'bob' right at the beginning of $var. */ echo substr_replace ($var, 'bob', 0, 0). "<br>\n"; /* These next two replace 'MNRPQR' in $var with 'bob'. */ echo substr_replace ($var, 'bob', 10, -1). "<br>\n"; echo substr_replace ($var, 'bob', -7, -1). "<br>\n"; // Example Ucfirst() $text = 'mary had a little lamb and she loved it so.'; $text = ucfirst ($text); // $text is now Mary had a little lamb // and she loved it so. // ucwords() example $text = "mary had a little lamb and she loved it so."; $text = ucwords($text); echo $text; //Text will be: Mary Had A Little Lamb And She Loved It So. http://localhost/test/p7/new25 - M... | File Edit View Back Address Favorites Tools Help Stop Refresh Home http://localhost/test/p7 Go Links Mary Had A Little Lamb And She Loved It So. 1 Done Local intranet // Example wordwrap() $text = "A very long woooooooooooord."; $newtext = wordwrap( $text, 8, "\n", 1); echo "$newtext\n"; ۲۱۳ الفصل السادس
ص ٢١٣

النص مستخرج آليًّا من صور الكتاب، وقد يقع فيه خطأ.