Welcome Guest, Not a member yet? Register   Sign In
Access Class Variable inside another class
#4

[eluser]m4rw3r[/eluser]
You can also make the property static:
Code:
class Page extends Controller
{
  static $_variable;
  function Page()
  {
    $this->_variable = "something";
  }

  function index()
  {
    $this->Library->method();
  {
}

class Library
{
  function method()
  {
    // Use $_variable
    echo Page::$_variable;
  }
}


Messages In This Thread
Access Class Variable inside another class - by El Forum - 02-18-2008, 01:45 PM
Access Class Variable inside another class - by El Forum - 02-18-2008, 01:48 PM
Access Class Variable inside another class - by El Forum - 02-18-2008, 03:17 PM
Access Class Variable inside another class - by El Forum - 02-18-2008, 04:08 PM
Access Class Variable inside another class - by El Forum - 02-18-2008, 04:10 PM
Access Class Variable inside another class - by El Forum - 02-19-2008, 07:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB