hmvrulz Posted October 24, 2008 Share Posted October 24, 2008 my Class class reg_validate extends validate { public $errors = array(); function __construct($input) { $this->errors['username'] = $this->username($input['username']); $this->errors['password'] = $this->password($input['password1'], $input['password2']); $this->errors['email'] = $this->email($input['email']); print_r($this->errors); return $this->errors; } function reg_error($input) { print_r($input); switch ($input['username']) { case '-1': echo 'error -1'; break; case '-2': echo 'error -2'; break; case '-3': echo 'error -3'; break; } } } INITIALIZING $reg_validate = new reg_validate($_POST); $reg_validate->reg_error($reg_validate); Object reg_validate Object ( [errors] => Array ( [username] => -3 [password] => -2 [email] => 1 ) [minUser] => 3 [minPass] => 6 ) ERROR am GETTING Fatal error: Cannot use object of type reg_validate as array in C:\Program Files\wamp\www\fw\models\users.php on line 31 HOW can i use the $input[username] in the switch to check for errors Link to comment https://forums.phpfreaks.com/topic/129942-fatal-error-cannot-use-object-of-type-reg_validate-as-array/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.