Press "Enter" to skip to content

Did you know about ctype* functions in php ?

How many times have we written the regular expressions to check whether it only consists of alphabets or just numeric?

And how many time we were so sure about that expression will work exactly?

Wished, it was known to me before doing a lots of those stupid regular expression stuffs.

So, PHP has a set of ctype_ prefixed functions. And now we can stop doing those dirty regular expression stuffs we do with regular expression.

The functions provided by ctype extension check whether a character or string falls into a certain character class according to the current locale.

It is not much, but it would actually remove a lots of common issues we face.

  1. ctype_alnum — Check for alphanumeric character(s)
  2. ctype_alpha — Check for alphabetic character(s)
  3. ctype_cntrl — Check for control character(s)
  4. ctype_digit — Check for numeric character(s)
  5. ctype_graph — Check for any printable character(s) except space
  6. ctype_lower — Check for lowercase character(s)
  7. ctype_print — Check for printable character(s)
  8. ctype_punct — Check for any printable character which is not whitespace or an alphanumeric character
  9. ctype_space — Check for whitespace character(s)
  10. ctype_upper — Check for uppercase character(s)
  11. ctype_xdigit — Check for character(s) representing a hexadecimal digit

Source: PHP.NET

Everything is awesome.

2 Comments

  1. Jupiemy
    Jupiemy September 2, 2018

    The spa body rub calls visit one of the options massage techniques, is what we do. The amazing women our the spa will give you an unforgettable experience. The spa salon is a place of rest and relaxation.
    The spa salon body rub massage in Dallas
    is currently considered most important way gain strength at the end of the strenuous working is Sensual massage.
    Rasprekrasny method best understand in sensations and preferences of a loved one – a common body rub massage, demonstrating powerful stimulating effect. The skill Happy ending massage in Nashville reveals space for creativity in building deep relations, besides this is amazing method express love and appreciation beloved to man.
    first-class curative massage in Miami from Charming the miss the massage. young people can visit to us in the erotic massage parlor you can choose any kind of massage yourself and relax with an erotic massage and we will make an unforgettable massage.

    Emma from the spa salon of the japanese massage in Kansas City become your favorite individual masseuse at any time.

    We have a showroom in Brooklyn. – body to body massage

  2. Norbert Gonnella
    Norbert Gonnella September 22, 2018

    Great post. I was checking constantly this blog and I am impressed! Extremely useful info particularly the last part 🙂 I care for such information a lot. I was seeking this certain information for a long time. Thank you and good luck.

Leave a Reply

Your email address will not be published.