Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.
class newClass
{
function newClass()
{
$this->doFirstThing();
$this->doSecondThing();
$this->doThirdThing();
}
function doFirstFirstThing()
{
// do something here
}
function doSecondThing()
{
// do something here
}
function doThirdThing()
{
// do something here
}
}
class newClass
{
function newClass()
{
$this->doFirstThing();
}
function doFirstFirstThing()
{
// do something here
$this->doSecondThing();
}
function doSecondThing()
{
// do something here
$this->doThirdThing();
}
function doThirdThing()
{
// do something here
}
}
The first way. Chaining method calls like that just makes things less flexible when you want to refactor a bit. Obvious if the same sequence of methods will "always" be run in the same order then you'd set something up but I wouldn't chain them like that, I'd wrapper them into a new method "doAllThings()"