Difference between private keyword and underscore before function name |
[eluser]John5788[/eluser]
Hello, I am reading a tutorial for CI and I noticed the author uses the keywords public private such as Code: <?php The user guide here: http://ellislab.com/codeigniter/user-gui...llers.html only says that an underscore before the function name is sufficient to be declared as a private function. Is this just redundancy or is there a difference between the two methods?
[eluser]danmontgomery[/eluser]
The public and private keywords were not supported until PHP5. Before then, it was generally accepted that adding an underscore to the beginning of a method name was declaring it "private". In this way, controller functions that start with _ are not accessible through a URL. |
Welcome Guest, Not a member yet? Register Sign In |