လက်ရှိတည်နေရာ: ပင်မစာမျက်နှာ> နောက်ဆုံးရဆောင်းပါးများစာရင်း> PHP String processing လုပ်ဆောင်ချက်များ - ဘုံနည်းစနစ်များနှင့်ဥပမာအားဖြင့်ခွဲခြမ်းစိတ်ဖြာခြင်း

PHP String processing လုပ်ဆောင်ချက်များ - ဘုံနည်းစနစ်များနှင့်ဥပမာအားဖြင့်ခွဲခြမ်းစိတ်ဖြာခြင်း

gitbox 2025-08-07

strlen () function ကို

strlen () string ၏အရှည်ကိုရရန်အသုံးပြုသည်။

 
$str = "Hello, world!";
echo strlen($str); // ထုတ်လုပ်ခြင်း 13

strip_replace () function ကို

strip_replace () သည်သတ်မှတ်ထားသောအကြောင်းအရာများကိုကြိုးဖြင့်အစားထိုးရန်အသုံးပြုသည်။

 
$str = "Hello, world!";
echo str_replace("world", "PHP", $str); // ထုတ်လုပ်ခြင်း Hello, PHP!

strtolower () function ကို

Strtolower () စာလုံးအသေးများကို string တစ်ခုပြောင်းသည်။

 
$str = "Hello, WORLD!";
echo strtolower($str); // ထုတ်လုပ်ခြင်း hello, world!

strtoupper () function ကို

Strtoupper () စာလုံးအကြီးများသို့ string ကိုပြောင်းသည်။

 
$str = "Hello, world!";
echo strtoupper($str); // ထုတ်လုပ်ခြင်း HELLO, WORLD!

Substric () function ကို

Substric () string ၏သတ်မှတ်ထားသောအစိတ်အပိုင်းကိုကြားဖြတ်ရန်အသုံးပြုသည်။

 
$str = "Hello, world!";
echo substr($str, 0, 5); // ထုတ်လုပ်ခြင်း Hello

trim () function ကို

trim () string နှစ်ခုစလုံးရဲ့စွန်းမှာ whitespace ဇာတ်ကောင်သို့မဟုတ်အခြားသတ်မှတ်ထားသောဇာတ်ကောင်များကိုဖယ်ရှားရန်အသုံးပြုသည်။

 
$str = "   Hello, world!   ";
echo trim($str); // ထုတ်လုပ်ခြင်း Hello, world!

exploit () function ကို

Exploit () strings များကို arrays ထဲသို့ခွဲရန်အသုံးပြုသည်။

 
$str = "Hello,world!";
$arr = explode(",", $str);
print_r($arr); // ထုတ်လုပ်ခြင်း Array ( [0] => Hello [1] => world! )

impline () function ကို

implode () ကို strings များသို့ array element တွေကိုပေါင်းစပ်ရန်အသုံးပြုသည်။

 
$arr = array("Hello", "world!");
$str = implode(",", $arr);
echo $str; // ထုတ်လုပ်ခြင်း Hello,world!

Preg_match () function ကို

PREG_MATCH () ပုံမှန်စကားရပ်ကိုက်ညီမှုကိုလုပ်ဆောင်ရန်အသုံးပြုသည်။

 
$str = "Hello, world!";
if (preg_match("/world/", $str)) {
    echo "အတွက် string ကိုရှိပါတယ် world!";
} else {
    echo "အဘယ်သူမျှမ string ကိုအတွက် world!";
}

htmlspecialchars () function ကို

code ကို browser မှခွဲထုတ်ခြင်းမှကာကွယ်ရန် HTMLSPECALCALCHARS () ကို HTML အဖွဲ့အစည်းများသို့ပြောင်းလဲရန်အသုံးပြုသည်။

 
$str = "Hello, world!";
echo htmlspecialchars($str); // ထုတ်လုပ်ခြင်း Hello, world!

အကျဉ်းချုပ်

ဤဆောင်းပါးသည် PHP တွင်အများအားဖြင့်အသုံးပြုသော string processing လုပ်ငန်းများကိုမိတ်ဆက်ပေးသည်။ ဤလုပ်ဆောင်မှုများကိုကျွမ်းကျင်သူများက developer များက string နှင့်သက်ဆိုင်သောလုပ်ငန်းများကိုပိုမိုပြောင်းလွယ်ပြင်လွယ်နှင့်ထိထိရောက်ရောက်ကိုင်တွယ်နိုင်အောင်ကူညီနိုင်အောင်ကူညီနိုင်သည်။