I am learning cakePHP 1.26.
I got a Controller which got two functions.
I was thinking to make $myVariable a global variable so that both functions in the controllers can share it, but I am not sure if this is the best way to declare a global variable in cakePHP:
class TestingController extends AppController {  
     var $myVariable="hi there";
    function hello(){
     if($newUser){echo $myVariable;}
      }
     function world(){
      if($newUser=="old"){$myVariable="hi my friends";}
      }
 }
Eğer yapabilirsen yardımcı olun.
Düzenlenen nedeni:
, Aircule Merhaba
Ben kodu biraz değişmiş ve öneri takip, ancak myVariable değeri hiç değişmedi değildi adres: 
class TestingController extends AppController {  
         var $myVariable="hi there";
        function hello(){
         echo $this->myVariable;
          }
         function world(){
          $this->myVariable="hi my friends";
          }
         function whatValue(){
         echo $this->myVariable;  // still output "hi there"
        }
     }
