With Codeigniter, what's the difference if I would like to set the method to private?

With callbackfunctions in the same class, I cannot set the following.

 private function check_valid_image
 {
 ...
 }

I can make it work if I do the following.

 function _check_valid_image
 {
 ...
 }

Putting an underscore in front of a method name is the same as putting a word in front of you private?

+5
source share
1 answer

This is the convention used with the form validation class for callbacks. It also makes this method not callable through URL segments.

However, this is not the equivalent of making the method private, which has implications for how code can be run outside the class.

+3
source

All Articles