need help with php functions

Status
Not open for further replies.

Sledmur

Web-Developer
Nov 29, 2011
459
98
Hey guys,

I need some help with OOP php...

Im not exactly sure as what the different functions (Private, public, construct etc) all do, could anyone explain? it'd be appreciated :)
 

tyr0ne

Active Member
Mar 29, 2012
141
14
Private functions are functions within the classes that stays private, in other words no functions outside of that class can access that function.
Public is the opposite. Let's say you have class A with function AA and class B with function BB. If AA is public, then BB can access that function for whatever reason that may be, but if AA is set to private (private function $AA()) then BB can't access it.

I've never dealt with PHP OOP, only ActionScript, but I'm guessing the constructor is only a function that is called to construct that object.

So basically when you create a new object
$obj = new Something();

the __construct() function is called and inside of it is all your code to make everything work.
 
Status
Not open for further replies.

Users who are viewing this thread

Top