Hello all,

I am writing to see what people thing about using php built in validors / filter? I was readying a website that talked about them instead of building your own.

What do you think and why?

Thanks for your input with these questions!

Sincerely,
Christopher

    I am writing to see what people thing about using php built in validors / filter? I was readying a website that talked about them instead of building your own.

    What do you think and why?

    I think that if you require the more advanced functionality that it provides, and you can be certain that it will be available on deployment, then you should use the filter functions. The obvious reason is that it is better to use code that is tested by many others than code that you cooked up yourself as the former is less likely to have bugs.

      Hello, thanks for the respones.

      how can I test if they have been setup on my system?

      Sincerely,
      Christopher

        One way:

        <?php
        if(function_exists('filter_var'))
        {
           echo "w00t!";
        }
        else
        {
           echo "Bummer.";
        }
        

          ok it says bummer!

          what can I do to install them, I have contral over that stuff as its a privite server type thing linode.com

          Sincerely,
          Christopher

            Hello,

            here is what I get when I try and install it:

            pecl install filter
            Failed to download pecl/filter within preferred state "stable", latest release is version 0.11.0, stability "beta", use "channel://pecl.php.net/filter-0.11.0" to install
            Cannot initialize 'filter', invalid or missing package file
            Package "filter" is not valid
            install failed
            [root@mail dev]# pecl install filter
            Failed to download pecl/filter within preferred state "stable", latest release is version 0.11.0, stability "beta", use "channel://pecl.php.net/filter-0.11.0" to install
            Cannot initialize 'filter', invalid or missing package file
            Package "filter" is not valid
            install failed

            Thanks for any help with this matter!

            Sincerely,
            Christopher

              PECL won't download or install beta applications by default. You have to insist by specifying the exact version (0.11.0 in this case). See "pecl help install" for further detail.

              As the error message states:

              use "channel://pecl.php.net/filter-0.11.0" to install

                Write a Reply...