Code Not working.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
imaxeman69
Forum Newbie
Posts: 4
Joined: Tue Jan 26, 2016 8:31 am

Code Not working.

Post 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.
Last edited by Celauran on Tue Jan 26, 2016 8:48 am, edited 1 time in total.
Reason: Please wrap your code in syntax tags
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Code Not working.

Post 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.
imaxeman69
Forum Newbie
Posts: 4
Joined: Tue Jan 26, 2016 8:31 am

Re: Code Not working.

Post by imaxeman69 »

It's actually part of an Abstract Class.

Is see what I did now. Thanks so much.
Post Reply