views:

64

answers:

3
class foo implements Countable {

    function count() {
        # do stuff here
    }
}

What's the type of count,public,protect or private?

+4  A: 

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.

Anthony Forloney
This is true, but I would also add that you should always make it a point to explicitly specify the visibility. It's just good practice.
Bart
@Bart, good point, updated my answer, thank you.
Anthony Forloney
A: 

It's type is public. In php if you don't specify scope for methods, it is assumed public.

Sarfraz
A: 

Public....unless specified otherwise.

easement