Re: [PHP4BETA] Testing ... PHP 4.0RC2 tarball
| From: | Nicolay Mausz | Date: | Sat, 06 May 2000 14:24:15 +0000 |
| Subject: | Re: [PHP4BETA] Testing ... PHP 4.0RC2 tarball | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-14590@lists.php.net to get a copy of this message | ||
>
> This is a bug. You should not use NULL as an object, whatever behaviour
> PHP shows in this case.
hmm - Maybe someone else has got opinions about that on this list ?
I asked about that several weeks ago on this list but I didn't got any
response.
> Because NULL is nothing. Not object. Not string. Not number. Nothing. You
> can't take attributes of nothing - because it's nothing.
>
> NM>> it is the same: $myarray["test"]="something" works without
>
> This implicitly creates an array. You cannot implicitly create object -
> you need class for it. Anyway, you can count this as initialization (for
> an array). Objects are initialized differently - with "new" keyword.
No you do not need a class - e.g. :
settype($obj,"OBJECT");
$obj->test="test"; works in every PHP version.
> NM>> initialization too. It would result in a bit more elegant and smaller
> NM>> PHP code.
>
> Elegant???? You call using non-initialized variables and depending on
> detals of particular implementation of some obscure case, which was never
> defined and never promised to work from the start, being elegant?
It isn't defined which implementation will be the right one anyware. I
asked about that in
http://marc.theaimsgroup.com/?l=php4beta&m=95436059406572&w=2
but I
didn't got any response.
I think it is important to clear it soon because it refers to the core
secripting engine.
That
> should be some new meaning for the work "elegant", previously unknown to
> me.
We are talking about PHP as a script-language and not about C or Java.
You can use non-initialized variables everywhere in PHP!
For example $var="something"; works. It you want to bring variable
initialization too PHP everywhere like in Java you should warn me
before. I think that 99% of all code written in PHP doesn't run anymore
:-))
I think that without the need for the settype workaround - PHP will be
more elegant and consistent and PHP should make programming as simple as
possible.
So I do not agree with you in that point. Maybe you can show me some PHP
code in which you it could cause some problems ?
Maybe it it a implementation or performance problem so I will understand
it.
> I still agreen there should be warning in this case or at least
> notice. Did you have notices turned on?
>
yes.
Nicolay