Welcome Guest, Not a member yet? Register   Sign In
Assigning & reading value to/from class var from 2 different functions
#1

[eluser]stef569[/eluser]
Code:
class Calender extends Controller {
  var $test = 'test';

function show() {
  $this->createEvents();
}

function createEvents() {
  $this->test = '55';
}

function printTest() {
  echo $this->test;
}

function doTest() {
  $this->createEvents();
  $this->printTest();
}
}
// /doTest/ => OK returns 55
// /createEvents/ => i gues it has been set
// /printTest/ => returns test!!!!!!!!!

When I first call show() in the uri and then printTest() it returns 'test', But i did call the function show to set it on '55'. Why is this?

Is the controller class reloaded everytime i refresh the page?


Messages In This Thread
Assigning & reading value to/from class var from 2 different functions - by El Forum - 11-04-2007, 08:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB