PHP

functions vs Public functions in Cakephp or MVC OOP


functions vs Public functions in Cakephp or MVC OOP

If you have two function one

public function name()
{
    ...content here
}

the other 

 

function name()
{
    ...content here
}

..They are the same, but Public function is better code practice and more explicit, the default is 'public' and forces developers to consider their method visibility. The methods that are available are: public, private and protected

Published: 1st June 2016 by

Adverts