Re: Class Auto-Assigning to Variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2013/8/7 Brian Smither <bhsmither@xxxxxxxxx>

> I have a situation where, for some unknown reason, where each class that
> finishes its __contruct{} function, that class gets automatically assigned
> to a variable - other than the variable I specify.
>
> Conceptually:
>
> class Hello { private $_world = 'World'; __construct(){} }
>

This isn't even valid PHP


 $ php -a
Interactive shell

php > class Hello { private $_world = 'World'; __construct(){} }
PHP Parse error:  syntax error, unexpected '__construct' (T_STRING),
expecting function (T_FUNCTION) in php shell code on line 1
php >



> $clsHello = new Hello();
>
> echo 'The variable $hello is '.gettype($hello)."\n".print_r($hello,true);
>
> Output:
> The variable $hello is object
> Hello Object
> (
>     [_world:Hello:private] => World
> )
>
> There is no statement in my application that assigns an instance of the
> class to another variable, the name being a lowercase variant of the class
> name.
>
> Would there be a PHP function that would do this as a side-effect?
>
> I am more interested in learning what is happening as opposed to rolling
> back to a previous version. (A backup copy functions fine. A file compare
> does not reveal any likely suspects.)
>
> PHP5.4.17-NTS-VC9 (Windows XP-SP3)
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
github.com/KingCrunch

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux