PHP Program to check whether number is Palindrome or not | PHP Find Palindrome Number
PHP null In Hindi | PHP is null Function
PHP stdClass In Hindi | stdClass In PHP
PHP Error Control Operator In Hindi | Error Control In PHP
PHP object Type Casting In Hindi | PHP object In Hindi
Send Email In Node.JS In Hindi | NodeMailer Example
Express.js helmet Example | Enhance Security In Node.JS App
Difference Between SOAP AND REST API In Node - Express In Hindi
If tutorials available on this website are helpful for you, please whitelist this website in your ad blocker😭 or Donate to help us ❤️ pay for the web hosting to keep the website running.
PHP में filtering / validation के लिए कई तरह के functions provide किये है like filter_var() , stripslashes()
.
इसके अलावा PHP में Ctype
Functions भी हैं जिनका use करके need के according characters / String को validate
/ filter
कर सकते हैं
●●●
Ctype extension एक तरह Functions का एक suit है , जिसमे कई useful functions है जो specially किसी string / character को validate करने के लिए use किये जाते है।
यह ध्यान दिया जाना चाहिए कि ctype functions को हमेशा regular expressions से अधिक prefer किया जाता है, यहां तक कि कुछ string functions "str_*"
और "is_*"
के equivalent भी । इसका कारण है कि ctype , native C library
को use करता है। जिसकी वजह से process काफी fast होती है।
Windows version के PHP में तो इस extension के लिए already built-in support होते है , तो Windows के लिए आपको install करने की जरूरत नहीं है। हाँ Linux / Mac OS के लिए आपको अलग से install करना पड़ सकता है।
ctype_alnum
ctype_alpha
ctype_cntrl
ctype_digit
ctype_graph
ctype_lower
ctype_print
ctype_punct
ctype_space
ctype_upperctype_xdigit
●●●
यह function दी गयी value में alphanumeric character को check करता है।
$strings = array("AbCd1zyZ9", "123456", "abcdef#@g");
foreach ($strings as $value) {
if (ctype_alnum($value)) {
echo "$value consists alphanumeric character(s)";
} else {
echo "$value does not consist alphanumeric character(s)";
}
}
Output
AbCd1zyZ9 consists alphanumeric character(s) 123456 consists alphanumeric character(s) abcdef#@g does not consist alphanumeric character(s)
●●●
यह function दी गयी value में alphabetic character को check करता है।
$strings = array("bdesdcda", "asdad456", "1232");
foreach ($strings as $value) {
if (ctype_alpha($value)) {
echo "$value consists alphabetic character(s)";
} else {
echo "$value does consist not consist alphabetic character(s)";
}
}
Output
bdesdcda consists alphabetic character(s) asdad456 does not consist alphabetic character(s) 1232 does not consist consist alphabetic character(s)
●●●
यह function दी गयी value में numeric character को check करता है।
$arr = array("324$32", "asdad456", "1232");
foreach ($arr as $value) {
if (ctype_digit($value)) {
echo "$value consists numeric character(s)";
} else {
echo "$value does not consist numeric character(s)";
}
}
Output
324$32 does not consist numeric alphabetic character(s) asdad456 does not consist numeric alphabetic character(s) 1232 consists numeric character(s)
●●●
यह function दी गयी value में check करता है कि सभी characters lowercase में है।
$arr = array("Rahul", "ravi");
foreach ($arr as $value) {
if (ctype_lower($value)) {
echo "$value consists all lowercase character(s)";
} else {
echo "$value does not consist all lowercase character(s)";
}
}
Output
Rahul does not consist all lowercase lowercase character(s) ravi consists all lowercase character(s)
●●●
यह function दी गयी value में check करता है कि सभी characters uppercase में है।
$arr = array("Rahul", "RAVI");
foreach ($arr as $value) {
if (ctype_upper($value)) {
echo "$value consists all lowercase character(s)";
} else {
echo "$value does not consist all lowercase lowercase character(s)";
}
}
Output
Rahul does not consist all lowercase lowercase character(s) RAVI consists all lowercase character(s)
Loading ...
Hi ! I'm Rahul Kumar Rajput founder of learnhindituts.com. I'm a software developer having more than 4 years of experience. I love to talk about programming as well as writing technical tutorials and blogs that can help to others. I'm here to help you navigate the coding cosmos and turn your ideas into reality, keep coding, keep learning :)
Get connected with me. :) LinkedIn Twitter Instagram Facebook