I have everything correct and I have closed ?>
the php tag and it still shows the error:
Parse error: syntax error, unexpected ‘?>’, expecting function (T_FUNCTION)
This is my code:
<?php
class IWP_MMB_ErrorLog extends IWP_MMB_Core {
function __construct() {
parent::__construct();
}
function get_errorLog($args) {
$myfile = fopen(ini_get('error_log'), "r") or die("Unable to open file!");
// Output one line until end-of-file
while (!feof($myfile)) {
$string = fgets($myfile);
$ar = explode("]", $string);
if (!empty($ar[0])) {
$remove = trim($ar[0], "[");
$remove1 = trim($remove, "UTC");
}
if (!empty($ar[1]) && !empty($ar[0])) {
$error_data[] = array(
'date' => $remove1,
'content' => $ar[1],
);
}
}
fclose($myfile);
return $error_data;
}
}
?>
I have a similar problem while using NetBeans. The file looks perfectly fine, but I get the same error as you. I suppose NetBeans needs some configuration, but what helps is just creating a new file, copy paste everything that’s inside and rename the file… Dirty solution but works…