Re: having fun with $this
| From: | 邢兴 | Date: | Sat, 08 Mar 2008 15:17:21 +0000 |
| Subject: | Re: having fun with $this | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-36061@lists.php.net to get a copy of this message | ||
Hi,
$this .= '123';
Should be
$this = '123';
or
$this = '';
$this .= '123';
must init the variable. Not only the $this but also any one.
Regards
Cristian Rodriguez 写道:
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Hi: It is still possible to re-asign $this in a number of ways examples <?php $this .= '123'; var_dump($this); //Notice: Undefined variable: this in this.php on line 3 //string(3) "123" <?php $this{1} = '123'; var_dump($this); /* array(1) { [1]=> string(3) "123" } */ or .. $this['foo'] = '123'; var_dump($this); In all those cases, I expect a fatal error : cannot re-asign $this. right ? or Im missing something ? Thanks..
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc