quotemeta function
quotemeta function သည် string ထဲရှိ အထူးစာလုံးတိုင်းရှေ့တွင် backslash တစ်ခုထည့်ပေးသည်။
အောက်ပါစာလုံးများကို escape လုပ်ပေးသည်: . \ + * ? [ ^ ] ( $ ).
Function သည် parameter တစ်ခုလက်ခံသည် - လုပ်ဆောင်ရန် string ။
Syntax
quotemeta(string);
ဥပမာ
ရိုးရှင်းသော string တစ်ခုထဲရှိ အထူးစာလုံးများကို escape လုပ်ခြင်း:
<?php
echo quotemeta('Hello.world (test)');
?>
ကုဒ်ကို run ပြီးရရှိသော ရလဒ်:
'Hello\.world \(test\)'
ဥပမာ
အထူးစာလုံးများစွာပါဝင်သော string တစ်ခုကို escape လုပ်ခြင်း:
<?php
echo quotemeta('1+1=2? [maybe]');
?>
ကုဒ်ကို run ပြီးရရှိသော ရလဒ်:
'1\+1\=2\? \[maybe\]'
ဥပမာ
အထူးစာလုံးမပါသော string ကို လုပ်ဆောင်ခြင်း:
<?php
echo quotemeta('simple text');
?>
ကုဒ်ကို run ပြီးရရှိသော ရလဒ်:
'simple text'
ဆက်စပ်ကြည့်ရှုရန်
-
addslashesfunction,
သည် string ကို slashes များဖြင့် escape လုပ်ပေးသည် -
preg_quotefunction,
သည် regular expression များထဲရှိ စာလုံးများကို escape လုပ်ပေးသည်