Coding small

    Date: 08/17/07 (PHP Community)    Keywords: no keywords

    foreach ($dbReq['modules'] as $modName)
    {
        if (!extension_loaded($modName))
        {
            $badDb = true;
            break;
        }
    }

    Seems pretty simple right? But c'mon, SEVEN lines of code?

    Sorry, this won't do. Why should a whole seven lines be used up for something so simple? Really, the simple stuff should be as invisible as possible, right?

    In the end, some if statement checks for the value of $badDb, but I renamed $badDb to $x and did this:

    while ((list(,$mn) = each($db['modules'])) && !isset($x)) if (!extension_loaded($mn)) $x = 1;

    Not only does it do the same thing, but it's just one line of code and it works with E_ALL.

    Source: http://community.livejournal.com/php/580218.html

« Imagemagick || php mail function logging »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home