Php Classroom image

Anil  Bist / Professional / Web Technology
 
To post your Question Join Classroom
 
Question No  (16 of 137)
First 12 I 13 I 14 I 15 I 16 I 17 I 18 I 19 I 20 Last
 
Question:-
How can we check the value of a given variable is alphanumeric?
 
Answer:-

bool ctype_alnum ( string $text )

<?php var_dump(ctype_alnum(-1));
// UNIX: bool(false)
// Windows: bool(true)

ctype_alnum() example (using the default locale)

<?php
$strings = array('AbCd1zyZ9', 'foo!#$bar');
foreach ($strings as $testcase) {
    if (ctype_alnum($testcase)) {
        echo "The string $testcase consists of all letters or digits.\n";
    } else {
        echo "The string $testcase does not consist of all letters or digits.\n";
    }
}
?>

The above example will output:

The string AbCd1zyZ9 consists of all letters or digits.
The string foo!#$bar does not consist of all letters or digits.

It is possible to use the dedicated function, ctype_alnum to check whether it is an alphanumeric value or not.

It is possible to use the dedicated function, ctype_alnum to check whether it is an alphanumeric value or not.

  
 
 
 
image
Anil  Bist

Skills    Php

Qualifications :- High School - SLV, College/University - Graphic Era Deemed Univ University,
Location :-Dehradun,Dehradun,Uttarakhand,
Description:-

in 2006, i Join a web development company in Bangalore and start work on "Ruby on Rail" this is my first web development framework and we worked in this framework and develop four to five project after some time , I moved to JEE/Sturst frame work,

After some time i decided that now times come and I have to go on in my own way and I started a company name is "Soarlogic&q
Explore

 

  Students (9)

Ask 
image
shubham
Ask 
Monika
Ask 
Anamika
Ask 
Riya
Ask 
image
Pooja
Ask 
Richa
Ask 
image
prateek
Ask 
Neha
Ask 
image
Amit
 
 

Recommended Classes

image shubham rauthan
I am a b.tech graduate in Information Technology and working as a Software Engineer and i wo...
Professional
image shubham rauthan
I am a b.tech graduate in Information Technology and working as a Software Engineer and i wo...
Professional
Rajendra Kumar
I have more then 5 year of Mobile App Development Experience and have worked in Android Native, I...
Professional