Dynamically create class vars

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dlite922
    Recognized Expert Top Contributor
    • Dec 2007
    • 1586

    Dynamically create class vars

    I'm still playing around with my framework.

    What would be nice If I could (like other popular framework) build a wrapper on vars coming in from the page.

    What I want to basically do is instead of accessing a $_POST['varname']

    i want to assign all the post vars, after clean up, to data members in my controllers so i can access the above variable like $childCT->varname;

    with the object reference (->), rather than calling $_POST.

    I want to avoid eval() too, by the way.

    isn't there some base class like __get() or something?

    Thanks,


    Dan
  • dlite922
    Recognized Expert Top Contributor
    • Dec 2007
    • 1586

    #2
    I did it again, dang sorry. I answered my own question via the first post again.

    IT IS actually __get() overload.

    There's a fine example at php.net/__get doing exactly what I needed to do.

    Just wanted to post this instead of deleting the OP so that other people can see it too.

    I seriously gotta reread my posts before hitting submit.

    :)

    bye!


    Dan

    Comment

    Working...