Welcome Guest, Not a member yet? Register   Sign In
Private and Public methods
#1

[eluser]rossmurphy[/eluser]
I notice in the CI library there are a lot of functions that are indicated to be private in the metadata but the methods do not begin with 'private function' or 'public function'. Why is this? And does this mean they are not actually private?

Also, by using:

Code:
var $value;

Does this variable become public? Whats the difference between using var vs public, private.

Cheers.
#2

[eluser]danmontgomery[/eluser]
Member variables default to public. Both:

Code:
var $value;
public $value;

Are identical in PHP5.

You're correct that the functions are not actually private, but they're not intended to be used publicly. PHP4 doesn't support public, private, protected, etc... So the _ is just an indication of public vs. private... Same with the var keyword, it's for legacy support.




Theme © iAndrew 2016 - Forum software by © MyBB