Page 1 of 1

Code Not working.

Posted: Tue Jan 26, 2016 8:36 am
by imaxeman69
I have a .php file that contains some static functions. It's loaded with a require_once() statement. I added a function, and now the code hangs. If I comment out the new function, it works. Here is the function:

Code: Select all

    static function GetDataLibs($iniFile) {
        $myINIFile = Fopen($iniFile, "r");
        $dataLibs = [];
        $idx = -1;
        while (!feof($myINIFile)) {
            $line = fgets($myINIFile);
            if (substr($line, 0, 7) == "library") {
                $dataLibs(++$idx) = substr($line, strpos($line, "=") + 1, 10);
            }
        }
        fclose($myINIFile);
        return $dataLibs;
    }
I'm not even calling this function yet.

Thanks.

Re: Code Not working.

Posted: Tue Jan 26, 2016 8:52 am
by Celauran
Is this a global function or part of a class? Doesn't need static if it's global. Also, you define $dataLibs as an array but later try to use it as a function.

Re: Code Not working.

Posted: Tue Jan 26, 2016 9:09 am
by imaxeman69
It's actually part of an Abstract Class.

Is see what I did now. Thanks so much.