I am running out of ideas as to what could be wrong with my code. This particular class accepts an array and checks it against another array to get the common values. Then it provides access to the common values thru final_post_vars_keys() function. But I get the error(in the title) whenever I run the code.
<?php
class PostVarsKeys {
private $general_keys = array("name", "email", "custom phone" , "lastname" , "firstname", "fname", "lname", "phone" , "emailaddress" ,
"phonenumber");
private $post_vars_keys = array();
public function __construct($post_keys){
$counter=0;
foreach($post_keys as $key => $value):
$this->post_vars_keys[$counter++] = $key;
endforeach;
}
public function final_post_vars_keys(){
return $final_keys = array_intersect($this->general_keys, $this->post_vars_keys);
}
}
general_keysand see if it's used anywhere else that could cause the value to change to something that isn't an array.