Im currently learning my way around OOP, i have come across something in a project that im researching and im not sure what it does.
I was wondering if anyone could explain it to me in a bit of detail.
There are 2 bits, as follows
$check_up = function($record) {
return ($record->status == 1);
};
Im completely lost by this as there is no $record variable set in the entire class, so where is it getting 'status' from ...
and the second example is:
$check_up = function($record) use($website) {
return ($record->check < $website->warning);
};
Any help would be really appreciated to understand this.
check_up($something)call somewhere?$recordvariable defined anywhere in the class, then it's a pretty meaningless anonymous function; but without seeing the rest of the class, we don't know$recordvariable is only defined in the local scope of the function. That function could be called in the scope of the$check_upvariable using something like$check_up($object_that_has_a_status_property);.