PHP filter_var_array() လုပ်ဆောင်ချက်
ဥပမာ
ကိန်းရှင်များစွာကို ရယူရန် filter_var_array() လုပ်ဆောင်ချက်ကို အသုံးပြုပါ။
<?php
$data = array(
'fullname' => 'Peter Griffin',
'age' => '41',
'email' => '[email protected]',
);
$mydata = filter_var_array($data);
var_dump($mydata);
?>
ကုဒ်၏အထွက်သည်-
array(3) {
["fullname"]=>
string(13) "Peter Griffin"
["age"]=>
string(2) "41"
["email"]=>
string(17)
"[email protected]"
}
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
filter_var_array() လုပ်ဆောင်ချက်သည် ကိန်းရှင်များစွာကို ရရှိပြီး ၎င်းတို့ကို ရွေးချယ်နိုင်သည် ။
ဤလုပ်ဆောင်ချက်သည် filter_var() ကိုအကြိမ်များစွာမခေါ်ဘဲတန်ဖိုးများစွာကိုစစ်ထုတ်ရန်အတွက်အသုံးဝင်သည်။
အကြံပြုချက်- ဤလုပ်ဆောင်ချက်နှင့် အသုံးပြုရန် ဖြစ်နိုင်ခြေရှိသော စစ်ထုတ်မှုများအတွက် PHP Filter ကိုးကား ချက်ကို စစ်ဆေး ပါ။
အထားအသို
filter_var_array(data_array, args, add_empty)
ကန့်သတ်တန်ဖိုးများ
Parameter | Description |
---|---|
data_array | Required. Specifies an array with string keys containing the data to filter |
args | Optional. Specifies an array of filter arguments. A valid array key is a variable name and a valid value is a filter ID, or an array specifying the filter, flags and option. This parameter can also be a single filter ID, if so, all values in the input array are filtered by the specified filter. A filter ID can be an ID name (like FILTER_VALIDATE_EMAIL) or an ID number (like 274) |
add_empty | Optional. A Boolean value. TRUE adds missing keys as NULL to the return value. Default value is TRUE |
နည်းပညာဆိုင်ရာအသေးစိတ်
ပြန်ပို့တန်ဖိုး- | အောင်မြင်မှုအပေါ် တောင်းဆိုထားသော ကိန်းရှင်များ၏ တန်ဖိုးများ အခင်းအကျင်းတစ်ခု၊ ရှုံးနိမ့်မှုအပေါ် မှားသည်။ |
---|---|
PHP ဗားရှင်း- | 5.2+ |
PHP Changelog- | PHP 5.4 - add_empty ပါရာမီတာကို ထည့်ထားသည်။ |
❮ PHP Filter အကိုးအကားကို အပြီးသတ်ပါ။