PHP States

I received an email a couple days ago from a UScript developer who was interested in applying something that seems to be pretty useful in UScript to provide a similar interface in PHP5. States. UScript pt States provide a developer with a means of encapsulating code, much the same way many of us have been doing for a long time with switches, and define methods and change their desired functionality.

    case "quick":
        include "overview.php";
    case "full-view":
        include "full.php";
        include "frontpage.php"

This may not be the best example for switches and their functionality, I don’t even suggest you necessarily use this, but it shows one thing. Changing functionality, based on variables. I am looking into a solution that is not only useful, but is at least readable.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.