Search code examples
phppear

Pear: Includes are successful but cannot find functions


EDIT: Solution...email is a function within Validate which is a class so you need to access it using:

Validate::email("[email protected]");

or

$val = new Validate(); $val->email("[email protected]");

Thanks red eyes

====================== original question ==============================

Hi,

I'm using Pear and have installed the package Validate to try it out.

Using the code:

<?php
require_once 'Validate.php';
email("[email protected]");
?> 

I get the error.

PHP Fatal error:  Call to undefined function email() in /home/benb/temp/pear.php on line 4

If I alter the code to include a non existent extension like require_once 'Validate2.php'; it gives me the error to say it can't find it. Also, if I view Validate.php I can see the email function within it.

So it seems as though it can find the extension but not the functions within it. Can anyone help? Thanks


Solution

  • It's possible to post Validate.php ? I think Validate.php it's PHP5 ;)

    So it's

    $val = new validate();
    $val->email();