PHP ကျူတိုရီရယ်

PHP ပင်မစာမျက်နှာ PHP မိတ်ဆက် PHP ထည့်သွင်းပါ။ PHP Syntax PHP မှတ်ချက်များ PHP Variables များ PHP Echo / Print PHP Data အမျိုးအစားများ PHP စာတန်းများ PHP နံပါတ်များ PHP သင်္ချာ PHP Constants PHP Operator များ PHP If...Else...Elseif PHP Switch PHP Loops PHP လုပ်ဆောင်ချက်များ PHP Arrays PHP Superglobals PHP RegEx

PHP Forms

PHP Form ကိုင်တွယ်ခြင်း။ PHP Form Validation PHP Form လိုအပ်ပါသည်။ PHP Form URL/E-mail PHP Form ပြီးပါပြီ။

PHP အဆင့်မြင့်

PHP နေ့စွဲနှင့် အချိန် PHP ပါဝင်ပါတယ်။ PHP ဖိုင်ကိုင်တွယ်ခြင်း PHP ဖိုင်ကို ဖွင့်/ဖတ်ပါ။ PHP ဖိုင်ကို ဖန်တီး/ရေးပါ။ PHP ဖိုင်ကို တင်ခြင်း။ PHP Cookies PHP စက်ရှင်များ PHP Filters PHP Filters Advanced PHP ပြန်ခေါ်ခြင်းလုပ်ဆောင်ချက်များ PHP JSON PHP ခြွင်းချက်

PHP OOP

PHP OOP ဆိုတာဘာလဲ PHP အတန်းများ/အရာဝတ္ထုများ PHP Constructor PHP Destructor PHP Access Modifiers PHP Inheritance PHP Constants PHP Abstract အတန်းများ PHP မျက်နှာပြင်များ PHP လက္ခဏာများ PHP Static Methods PHP Static Properties PHP Namespaces PHP Iterables

MySQL ဒေတာဘေ့စ်

MySQL ဒေတာဘေ့စ် MySQL ချိတ်ဆက်မှု MySQL သည် DB ကိုဖန်တီးပါ။ MySQL ဇယားဖန်တီးပါ။ MySQL သည် Data ကိုထည့်သွင်းပါ။ MySQL နောက်ဆုံး ID ကိုရယူပါ။ MySQL တွင် Multiple ထည့်သွင်းပါ။ MySQL ပြင်ဆင်ထားသည်။ MySQL Data ကို ရွေးပါ။ MySQL ဘယ်မှာလဲ။ MySQL Order By MySQL က Data တွေကို ဖျက်လိုက်ပါ။ MySQL အပ်ဒိတ်ဒေတာ MySQL ကန့်သတ်ဒေတာ

PHP XML

PHP XML ပါဆာများ PHP SimpleXML Parser PHP SimpleXML - ရယူပါ။ PHP XML Expat PHP XML DOM

PHP - AJAX

AJAX နိဒါန်း AJAX PHP AJAX ဒေတာဘေ့စ် AJAX XML AJAX တိုက်ရိုက်ရှာဖွေမှု AJAX စစ်တမ်း

PHP ဥပမာများ

PHP ဥပမာများ PHP Compiler PHP Quiz PHP လေ့ကျင့်ခန်းများ PHP Certificate

PHP အ ကိုးအကား

PHP ခြုံငုံသုံးသပ်ချက် PHP Array PHP ပြက္ခဒိန် PHP နေ့စွဲ PHP လမ်းညွှန် PHP အမှား PHP ခြွင်းချက် PHP ဖိုင်စနစ် PHP Filter PHP FTP PHP JSON PHP သော့ချက်စာလုံးများ PHP Libxml PHP Mail PHP သင်္ချာ PHP ထွေ PHP MySQLi PHP ကွန်ရက် PHP Output Control PHP RegEx PHP SimpleXML PHP Stream PHP String PHP Variable ကိုင်တွယ်ခြင်း။ PHP XML Parser PHP Zip PHP အချိန်ဇုန်များ

PHP sscanf() လုပ်ဆောင်ချက်

❮ PHP String အကိုးအကား

ဥပမာ

စာကြောင်းတစ်ခုကို ပိုင်းခြားရန်-

<?php
$str = "age:30 weight:60kg";
sscanf($str,"age:%d weight:%dkg",$age,$weight);
// show types and values
var_dump($age,$weight);
?>

sscanf() လုပ်ဆောင်ချက်သည် သတ်မှတ်ထားသော ဖော်မတ်တစ်ခုအရ စာကြောင်းတစ်ခုမှ ထည့်သွင်းမှုကို ခွဲခြမ်းစိပ်ဖြာသည်။ sscanf() လုပ်ဆောင်ချက်သည် ဖော်မတ်စာတစ်ကြောင်းအပေါ် အခြေခံ၍ လိုင်းတစ်ခုကို ကိန်းရှင်များအဖြစ် ပိုင်းခြားပေးသည်။

ကန့်သတ်ချက်နှစ်ခုသာ ဤလုပ်ဆောင်ချက်သို့ ကူးသွားပါက၊ ဒေတာကို ခင်းကျင်းတစ်ခုအဖြစ် ပြန်ပို့ပေးပါမည်။ မဟုတ်ပါက၊ ရွေးချယ်နိုင်သော ကန့်သတ်ဘောင်များကို ကျော်သွားပါက၊ ခွဲခြမ်းစိတ်ဖြာထားသည့် ဒေတာကို ၎င်းတို့တွင် သိမ်းဆည်းထားသည်။ ၎င်းတို့ကို ပါ၀င်ရန် ကိန်းရှင်များထက် အတိအကျသတ်မှတ်မှု ပိုများပါက အမှားအယွင်းတစ်ခု ဖြစ်ပေါ်သည်။ သို့ရာတွင်၊ ကိန်းရှင်များထက် အတိအကျသတ်မှတ်မှုနည်းပါက၊ အပိုကိန်းရှင်များတွင် NULL ပါဝင်ပါသည်။

ဆက်စပ်လုပ်ဆောင်ချက်များ-

  • printf() - ဖော်မတ်ချထားသော စာကြောင်းကို ထုတ်သည်။
  • sprintf() - ပုံစံချထားသော စာကြောင်းတစ်ခုကို ကိန်းရှင်တစ်ခုသို့ ရေးသည်။

အထားအသို

sscanf(string,format,arg1,arg2,arg++)

ကန့်သတ်တန်ဖိုးများ

Parameter Description
string Required. Specifies the string to read
format Required. Specifies the format to use.

Possible format values:

  • %% - Returns a percent sign
  • %c - The character according to the ASCII value
  • %d - Signed decimal number (negative, zero or positive)
  • %e - Scientific notation using a lowercase (e.g. 1.2e+2)
  • %u - Unsigned decimal number (equal to or greather than zero)
  • %f - Floating-point number
  • %o - Octal number
  • %s - String
  • %x - Hexadecimal number (lowercase letters)
  • %X - Hexadecimal number (uppercase letters)

Additional format values. These are placed between the % and the letter (example %.2f):

  • + (Forces both + and - in front of numbers. By default, only negative numbers are marked)
  • ' (Specifies what to use as padding. Default is space. Must be used together with the width specifier. Example: %'x20s (this uses "x" as padding)
  • - (Left-justifies the variable value)
  • [0-9] (Specifies the minimum width held of to the variable value)
  • .[0-9] (Specifies the number of decimal digits or maximum string length)

Note: If multiple additional format values are used, they must be in the same order as above.

arg1 Optional. The first variable to store data in
arg2 Optional. The second variable to store data in
arg++ Optional. The third, fourth, and so on, to store data in


နည်းပညာဆိုင်ရာအသေးစိတ်

ပြန်ပို့တန်ဖိုး- ကန့်သတ်ချက်နှစ်ခုသာ ဤလုပ်ဆောင်ချက်သို့ ကူးသွားပါက၊ ဒေတာကို ခင်းကျင်းတစ်ခုအဖြစ် ပြန်ပို့ပေးပါမည်။ မဟုတ်ပါက၊ ရွေးချယ်နိုင်သော ကန့်သတ်ဘောင်များကို ကျော်သွားပါက၊ ခွဲခြမ်းစိတ်ဖြာထားသည့် ဒေတာကို ၎င်းတို့တွင် သိမ်းဆည်းထားသည်။ ၎င်းတို့ကို ပါ၀င်ရန် ကိန်းရှင်များထက် အတိအကျသတ်မှတ်မှု ပိုများပါက အမှားအယွင်းတစ်ခု ဖြစ်ပေါ်သည်။ သို့ရာတွင်၊ ကိန်းရှင်များထက် အတိအကျသတ်မှတ်မှုနည်းပါက၊ အပိုကိန်းရှင်များတွင် NULL ပါဝင်ပါသည်။
PHP ဗားရှင်း- 4.0.1+

နောက်ထပ် ဥပမာများ

ဥပမာ

ဖော်မတ်တန်ဖိုးများ %s၊ %d နှင့် %c ကိုအသုံးပြုခြင်း-

<?php
$str = "If you divide 4 by 2 you'll get 2";
$format = sscanf($str,"%s %s %s %d %s %d %s %s %c");
print_r($format);
?>

❮ PHP String အကိုးအကား