• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
public function

#1
Hello,

I have a quick question regarding the function of writing "public" in the beginning of function.

What is the difference between writing:


models/Mpages.php


PHP Code:
public function login() {}

and

function 
login() {} 
" If I looks more intelligence please increase my reputation."
Reply

#2
It's the same. The first one is more explicit and you should use it for better clarity.

For more info:
http://stackoverflow.com/questions/43615...-protected
Reply

#3
http://php.net/manual/en/language.oop5.visibility.php
Reply

#4
in writing inside the class you have to specify whether it is public, static, or private.
God Bless CI Contributors Smile
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.