Call to undefined function filter_var()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
eskio
Forum Commoner
Posts: 66
Joined: Tue Apr 01, 2008 1:00 am

Call to undefined function filter_var()

Post by eskio »

Hi, I have the following error when I tried to use filter_var() function:

Fatal error: Call to undefined function filter_var() in Url\functions.php on line 5

I want to know if I have to install a php extension before using the function?

:crazy:

Please help
User avatar
EverLearning
Forum Contributor
Posts: 282
Joined: Sat Feb 23, 2008 3:49 am
Location: Niš, Serbia

Re: Call to undefined function filter_var()

Post by EverLearning »

You need Filter extension for filter_var() to work.

PHP 5.2.0 or later has Filter bundled and enabled by default. There is no need to manually install it. If you have earlier version of PHP than you'll have to install it yourself.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: Call to undefined function filter_var()

Post by onion2k »

You need to be using PHP 5.2.0 or later, and install the Filter PECL library. http://uk3.php.net/filter

EDIT: Beaten to it!
eskio
Forum Commoner
Posts: 66
Joined: Tue Apr 01, 2008 1:00 am

Re: Call to undefined function filter_var()

Post by eskio »

EverLearning wrote:You need Filter extension for filter_var() to work.

PHP 5.2.0 or later has Filter bundled and enabled by default. There is no need to manually install it. If you have earlier version of PHP than you'll have to install it yourself.

from where can I get the extension to install
User avatar
EverLearning
Forum Contributor
Posts: 282
Joined: Sat Feb 23, 2008 3:49 am
Location: Niš, Serbia

Re: Call to undefined function filter_var()

Post by EverLearning »

For linux just type

Code: Select all

pecl install filter
in your console.

For windows download appropriate dll from pecl4win.php.net and add it to php.ini
Post Reply