Sign in to follow this  

PHP Array and Class problem

This topic is 4298 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am having a problem using an array inside a class in php. Here is my class: class Errors{ private $errors = array(); private $numErrors; function __construct(){ $numErrors = 1; $errors[1] = 1; } function Failed($fieldIn){ if($errors[1]){ return 'true'; } else{ return 'false'; } } } however, when I go to test that. The Failed function returns false... What am I doing wrong there?

Share this post


Link to post
Share on other sites

This topic is 4298 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this