PHP Classes

File: invalidcharacters.php

Recommend this page to a friend!
  Classes of Juan Chaves   Invalid Characters   invalidcharacters.php   Download  
File: invalidcharacters.php
Role: Example script
Content type: text/plain
Description: Class Invalid Characters
Class: Invalid Characters
Check if a string has any invalid characters
Author: By
Last change:
Date: 13 years ago
Size: 874 bytes


Class file image Download

//class invalid characters

class InvalidCharacters


public function


$charactersok = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";//Please insert here the characters that you consider as valid.
for ($i=0; $i<strlen($view); $i++){
              if (
strpos($charactersok, substr($view,$i,1))===false){
$this->allowed=false;return $this->allowed;
$this->allowed=true;return $this->allowed;

public function
        if (
        if (
$this->allowed==false){echo 'Invalid character(s)';exit();}


//example of how to apply

$info=new InvalidCharacters();
$info->reviews_allowed("lkji˝");//Please insert here the characters to be checked.
"Ok";//The script continues here.