That's exactly the info i was asking for in my last post.
There is a huge difference between a CLASS and an INSTANCE.
It's very important use those terms properly, otherwise we won't understand each other...
Classes can have methods and attributes. They are called STATIC.
You don't need an instance to access the static methods and attributes.
Static methods are fine.
Static attributes are only fine when they are "constants" ("static final" in Java), otherwise they are equivalent to "globals".
The typical example is the Math class: "Math.pi" is a static constant, "Math.sin()" is a static method.
All the methods and attributes that are not static are methods and attributes of INSTANCES.
Having clarified that, you mean that an instance of Log is getting the user's IP and an instance of Ban wants to access it? Is that correct?
How about something like this?
$myLog = new Log();
$myIP = $myLog->getIP();
Like VGR, I hate OOP's "inheritance". On the other hand, i love everything else in OOP.
Famous article against inheritance:
http://www.javaworld.com/javaworld/jw-08-2003/jw-0801-toolbox.htmlOnly use inheritance when there is absolutely no doubt there is a child/parent relationship.
If there is one small doubt, then use an attribute to store the relationship:
Log "has a" Security
Ban "has a" Security
This might require a little more code, but it's much better.
It might be a good idea to pass the related instance in the constructor:
$mySecurity = new Security();
$myLog = new Log($mySecurity);
$myBan = new Ban($mySecurity);
And maybe also pass the Log instance to Ban's constructor:
$myBan = new Ban($mySecurity, $myLog);
Could you explain what you need the "Security" class for?
From your questions and from the names of the classes, I would have guessed exactly the opposite relationships:
Security "has a" Log
Security "has a" Ban
As you can see, it's extremely difficult to know what your Object Model should be if we don't know what the classes are supposed to represent.