|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-02-16 09:41 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 12 18:00:01 2025 UTC |
Description: ------------ Why in "static method" name of "parameter" can not be "$this" ? Reproduce code: --------------- <?php header("Content-Type: text/plain; charset=koi8-r"); class Base { public $x= 'x', $y= 'y'; public static function fnTest($this) { echo __CLASS__,'::',__FUNCTION__,"()\t",get_class($this),"\n"; list($this->x, $this->y)= array($this->y, $this->x); print_r($this); } } $o= new Base; Base::fnTest($o); ?> Expected result: ---------------- Base::fnTest()Base Base Object ( [x] => y [y] => x ) Actual result: -------------- [Thu Feb 16 11:31:32 2006] [error] [client 192.168.0.250] PHP Fatal error: Using $this when not in object context in D:\\dev\\Site\\test.htm on line 11