For example I try this code:
Code: Select all
$ob = new stdClass;
$ob->prop = 'val';
$ob->site = function($dom) {
return 'http://'. $dom .'/';
};
echo $ob->site('coursesweb.net');
Code: Select all
Call to undefined method stdClass::site() in ..
Code: Select all
$ob = new stdClass;
$ob->prop = 'val';
$ob->site = function($dom) {
return 'http://'. $dom .'/';
};
echo $ob->site('coursesweb.net');
Code: Select all
Call to undefined method stdClass::site() in ..
Code: Select all
$ob = new stdClass;
$ob->prop = 'val';
$ob->site = function($dom) {
return 'http://'. $dom .'/';
};
$site = $ob->site; // assign the method to a variable
echo $site('coursesweb.net'); // https://coursesweb.net/