class foo implements Countable {
function count() {
# do stuff here
}
}
What's the type of count
,public,protect or private?
class foo implements Countable {
function count() {
# do stuff here
}
}
What's the type of count
,public,protect or private?
Class methods may be defined as public, private, or protected. Methods declared without any explicit visibility keyword are defined as public.
Same behaviors also apply for class properties.
Taken from PHP: Visibility
As Bart has noted in his comment, although PHP will assign the visibility for you (if one is not explicitly assigned), it is strongly recommended for good practice and coding standards to assign the visibility for yourself.
It's type is public
. In php if you don't specify scope for methods, it is assumed public.