Classes and declaring variables

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jay Moore

    Classes and declaring variables

    Greetings, all!

    I have a question about classes and variables.

    When you are working with a class, when should you (or are required) to
    declare variables? Is it if you plan on setting a variable from outside
    the class as in ( $foo->bar = "data" ), or if the variable is 'created'
    inside the class as in ( $this->bar = "data"), or both?

    TIA
    -Jay

  • Jochen Daum

    #2
    Re: Classes and declaring variables

    Hi Jay!

    On Tue, 30 Sep 2003 08:20:59 -0500, Jay Moore <address@isp.tl d> wrote:
    [color=blue]
    >Greetings, all!
    >
    >I have a question about classes and variables.
    >
    >When you are working with a class, when should you (or are required) to
    >declare variables? Is it if you plan on setting a variable from outside
    >the class as in ( $foo->bar = "data" ), or if the variable is 'created'
    >inside the class as in ( $this->bar = "data"), or both?[/color]

    Both. Otherwise, if you access it you get an
    "Undefined property..." notice.

    HTH, Jochen[color=blue]
    >
    >TIA
    >-Jay[/color]

    --
    Jochen Daum - CANS Ltd.
    PHP DB Edit Toolkit -- PHP scripts for building
    database editing interfaces.
    Download PHP DB Edit Toolkit for free. PHP DB Edit Toolkit is a set of PHP classes makes the generation of database edit interfaces easier and faster. The main class builds tabular and form views based on a data dictionary and takes over handling of insert/update/delete and user input.

    Comment

    Working...