|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-12-05 07:13 UTC] gopalv82 at yahoo dot com
[2006-12-08 08:58 UTC] grikdotnet at aim dot com
[2007-01-09 04:35 UTC] gopalv82 at yahoo dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 17 15:00:01 2025 UTC |
Description: ------------ When connecting to the memcache server the variable "dissappears". Reproduce code: --------------- <?php class A{ function connect(){ $memcache = new Memcache; if ( $memcache->pconnect ('10.1.1.10','11211') ){ return 'OK'; } } } $a = new A(); echo $a->connect(); //it says that $a does not exist ?> Note, this works: <?php $a = new A(); class A{ function connect(){ $memcache = new Memcache; if ( $memcache->pconnect ('10.1.1.10','11211') ){ return 'OK'; } } } echo $a->connect(); //everything is OK ?> Expected result: ---------------- OK Actual result: -------------- Notice: Undefined variable: a in /www/test.php on line 12 Fatal error: Call to a member function connect() on a non-object in /www/test.php on line 12