RE: [PHP4BETA] A quick clarification question about PHP4...

From: Date: Mon, 30 Aug 1999 14:33:52 +0000
Subject: RE: [PHP4BETA] A quick clarification question about PHP4...
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-3879@lists.php.net to get a copy of this message
It does work fine in PHP3, and I think it will work in PHP4 as well, as long as the values passed in the init code are not variables, just values of some type that can be determined at "compile" (or parse) time. In my not so humble opinion, passing vars to init code makes the language much more useful. If I knew what the values would be when I wrote the code, I probably wouldn't need to pass them. I thought getting rid of the value options for init classes would clean up the spec a bit, as I am sure as shooting that if you allow people to pass things, they will try to pass vars... Who wants to answer the reason why it can't be done in PHP4 50 million times for new users. Although I didn't completely understand the logic behind why var passing in PHP4 for class inits was taken out, I am not going to make it a capital issue. PHP4 has a lot of nice features, so I'll give this up for some of the others, like built-in session management. I post the concern for two reasons. One was to determine if this was really being taken out for some specific reason or of it was just hard to do, so it was left out. It seems the former reason explains. Two was to remind everyone why I and probably so many others use PHP. It is much easier than ASP to learn and love. Typeless vars and not needing to type vars or woory about types when passing. (My personal pet peeve with VB[Script|A|] is that they require objects be declared of object type on the parm line on a function, whereas regular vars do not. Very counterintuitive to me. Either require types on all vars, or none...) On to other topics. Jim -- Jim Brain Systems Architect, CSG.web Development jim_brain@csgsystems.com 431-7754 -----Original Message----- From: Scott Stevenson [mailto:scott@maxify.com] Sent: Friday, August 27, 1999 9:41 PM To: php4beta@lists.php.net Subject: Re: [PHP4BETA] A quick clarification question about PHP4... Jim Brain said: > As for the init code, it seems you really can't pass anything useful to an > init function, which implies that: > > $jim=new junk; > > Would work better than > > $jim=new junk(); I'm not sure why you wouldn't want to pass stuff there. For example, this seems useful, and works fine in PHP3: -------- class myClass { function myClass($name) { $this->myVar = "Hello, $name!"; } } $myInstance = new myClass(Scott); echo $myInstance->myVar; -------- Maybe I missed something in this exchange? - Scott -- PHP 4 Beta

« previous php.version4 (#3879) next »