PHP wordwrap() လုပ်ဆောင်ချက်
ဥပမာ
သတ်မှတ်ထားသော အရှည်သို့ရောက်သောအခါ ကြိုးတစ်ချောင်းကို မျဉ်းအသစ်များဖြင့် စည်းပါ-
<?php
$str = "An example of a long word is: Supercalifragulistic";
echo wordwrap($str,15,"<br>\n");
?>
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
wordwrap() လုပ်ဆောင်ချက်သည် သတ်မှတ်ထားသော အရှည်တစ်ခုသို့ ရောက်ရှိသောအခါတွင် စာကြောင်းအသစ်များအဖြစ် ပေါင်းစည်းသည်။
မှတ်ချက်- ဤလုပ်ဆောင်ချက်သည် စာကြောင်းတစ်ခု၏အစတွင် အဖြူကွက်များကို ချန်ထားနိုင်သည်။
အထားအသို
wordwrap(string,width,break,cut)
ကန့်သတ်တန်ဖိုးများ
Parameter | Description |
---|---|
string | Required. Specifies the string to break up into lines |
width | Optional. Specifies the maximum line width. Default is 75 |
break | Optional. Specifies the characters to use as break. Default is "\n" |
cut |
Optional. Specifies whether words longer than the specified width should be wrapped:
|
နည်းပညာဆိုင်ရာအသေးစိတ်
ပြန်ပို့တန်ဖိုး- | အောင်မြင်မှုတွင် လိုင်းများကွဲသွားသော စာကြောင်းကို ပြန်ပေးသည် သို့မဟုတ် ပျက်ကွက်မှုတွင် အမှားကို ပြန်ပေးသည်။ |
---|---|
PHP ဗားရှင်း- | 4.0.2+ |
ပြောင်းလဲမှုမှတ်တမ်း- | ဖြတ်တောက်ထားသော က န့်သတ် ဘောင်ကို PHP 4.0.3 တွင် ထည့်သွင်းခဲ့သည်။ |
နောက်ထပ် ဥပမာများ
ဥပမာ
ကန့်သတ်ချက်များအားလုံးကို အသုံးပြုခြင်း-
<?php
$str = "An example of a long word is: Supercalifragulistic";
echo wordwrap($str,15,"<br>\n",TRUE);
?>
ဥပမာ
ကြိုးတစ်ချောင်းကို မျဉ်းအသစ်အဖြစ် ထုပ်ပါ-
<?php
$str = "An example of a long word is: Supercalifragulistic";
echo wordwrap($str,15);
?>
အထက်ဖော်ပြပါ code ၏ HTML အထွက်သည် (View Source) ဖြစ်လိမ့်မည်။
<!DOCTYPE html>
<html>
<body>
An example of a
long word is:
Supercalifragulistic
</body>
</html>
အထက်ဖော်ပြပါ ကုဒ်၏ ဘရောက်ဆာ၏ ထွက်ပေါက်သည်-
An example of a long word is: Supercalifragulistic
❮ PHP String အကိုးအကား