Reputation: 5441
I have a class(DaySummary*) with a static function that I've created:
public static function recursive_in_array($search, $arr) {
foreach ($arr as $item) {
if(is_array($item))
return recursive_in_array($search, $item);
elseif($search == $item)
return true;
}
return false;
}
Within the code in another function (not a static function in the class) I try to use this function by doing:
if(self::recursive_in_array('taanitE', $exceptions))
echo 'it is';
else
echo 'it isn"t';
But I get an error saying:
Call to undefined function recursive_in_array()
Why do I get this error? The function is clearly defined!
*DaySummary is inherited from DayAnalyzer which is inherited from DayData.
Upvotes: 0
Views: 60
Reputation: 44844
return recursive_in_array($search, $item);
change to
return self::recursive_in_array($search, $item);
Check here for more details : http://php.net/manual/en/language.oop5.static.php
Upvotes: 2