php variable scope in oop
- by mr o
Hi, I wonder if anyone can help out here, I'm trying to understand how use an objects properties across multiple non class pages,but I can't seem to be able to get my head around everything i have tried so far.
For example a class called person;
class person {
static $name;
}
but i have a number of different regular pages that want to utilize $name across the board.
I have trying things like this;
pageone.php
include "person.php";
$names = new Person();
echo person::$name;
names::$name='bob';
pagetwo.php
include "person.php";
echo person::$name;
I can work with classes to the extent I'm OK as long as I am creating new instances every page, but how can make the properties of one object available to all, like a shared variable ?
Thanks