On Wed, 11 Aug 2004 09:14:08 -0600, Jed R. Brubaker <[EMAIL PROTECTED]> wrote: > Hi all. As the subject suggests, I am using PHP4 and am having something > going on that I don't think should be. > > Presume the following code > class Foo { > function Foo () { > return "Bar";
You shouldn't be returning from a constructor. > } > } > $foo = new Foo; > echo $foo; It's generally bad prcative to echo anything other than scalar types (strings and numbers). Try using print_r() or var_dump() instead. > > $foo comes out as an object. Does this have to be done in two line like > this?: > class Foo { > function bar () { > return "Bar"; > } > } > $foo = new Foo; > $bar = $foo->bar; Yes, this has to be two lines. I'm not sure how you'd want to put this as one. In addition, you should have parenthesis on your funciton call: $bar = $foo->bar(); > > Or is there a better design approach I should be reminded of or learn? > -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php