- file_get_contents: documentation ( source)
<?php
class myClass {
function abc() {
echo file_get_contents('http://google.com');
$callback = function(){ //Here is the syntax error
return 'Hello world!<br>';
};
return $GLOBALS['otherClass']->birds($callback);
}
}
class otherClass {
function birds($callback) {
return $callback();
}
}
$GLOBALS['otherClass'] = new otherClass();
$myClass = new myClass();
echo $myClass->abc();
echo $myClass->abc();