I often see code a function defined without visibility keywords. e.g:
class Foo() {
function bar() {
// ...
}
}
Is it a shorthand of public function? Is it a good practice to omit it?
class Foo() {
public function bar() {
//..
}
}
As written in the PHP Doc,
So, yes, in
Foo::bar()is public, but omitting the visibility keyword is never a good practice. If it’s a fast and ugly script why not, but in other cases you should specify it.