I have an strange problem...
I have this function:
Code: Select all
public function get_disname($x) {
if($this->_data['samaccountname']['0'] != $x) { $this->_data = $this->user_info($x); }
return $this->_data['displayname']['0'];
}Basicly what all does is: if the info we whant is stored in the local array: _data don't do a new query get it from the local protected array instead.
(it gets all user info first time it wants something, and if its the same person we want another info from use the local array)
Sofar so good.. but if i have another php page that uses this, and say it whant to get 5 different entries from AD, each: if($this->_data['samaccountname']['0'] != $x) takes ~2 seconds to execute
5 entries = 10 seconds for page to load.
if i remove the if statement, and just use it the first time(then all is stored in local array) the total time is 2-3sec instead of 10.
And the only thing difference is that it doent check: if($this->_data['samaccountname']['0'] != $x) 4 times, just 1.
How can this IF statement be so slow?
(it doesnt take 10 second for 1 person, but im looping this to get values from ~100 users)