Hello,

I dont know about you but for me if their is an easy and shorter way of coding in PHP then i will se it. To day i made a small filter function (untested)

PHP Code: 
<?php
/**
  * @authors Jordan Hall <nukezilla@hotmail.co.uk> & JokerHacker
  * @Acknowledge S.C. Chen <http://sourceforge.net/projects/simplehtmldom/>
  * @Contributions Bennett Treptow <Upload class>
  * @SpecailThanks Bennett Treptow  for teching me Comparison Operators
  * @version 0.1
  * @copyright 2012 Sim*****HP
  */
    
function filter ($type$input$min null$max null)
    {
        
$type strtolower($type);
        if (
$type == "string")
        {
         if(
$min == null && $max == null){
         {
             return (
filter_var($inputFILTER_SANITIZE_STRINGFILTER_FLAG_STRIP_HIGH)) ? $input:false;
         else
         {
             if (
strlen($input) < $min || (strlen($input) > $max )
            {
                 return 
false;
            }
            else
            {
                return 
$input;
            }
         }
        }
        elseif (
$type == "int")
        {
         return (
filter_var($inputFILTER_SANITIZE_NUMBER_INT)) ? $input:false;
        }
        elseif (
$type == "url")
        {
         return (
filter_var($inputFILTER_SANITIZE_URL)) ? $input:false;
        }
        elseif (
$type == "ip")
        {
         if (
filter_var($inputFILTER_VALIDATE_IP)) ? $input:false;
        }
        elseif (
$type == "email")
        {
         if (
filter_var($inputFILTER_SANITIZE_EMAIL)) ? $input:false;
        }
    }
?>
?>
Regards,
Jordan
xifyhosting Reviewed by xifyhosting on . Simplex PHP filter function Hello, I dont know about you but for me if their is an easy and shorter way of coding in PHP then i will se it. To day i made a small filter function (untested) <?php /** * @authors Jordan Hall <nukezilla@hotmail.co.uk> & JokerHacker * @Acknowledge S.C. Chen <http://sourceforge.net/projects/simplehtmldom/> * @Contributions Bennett Treptow <Upload class> Rating: 5