Let's say in PHP you have a class Parent:
<?php
class Parent {
public function speak()
{
// Do bunch of stuff
$output = outcomeOfAbove();
echo $output;
}
}
And you have a class Child:
<?php
class Child extends Parent{
public function speak()
{
parent::speak();
echo 'Hello from child';
}
}
Now let's say that I want the content of $output in the Child speak() function, is there a way to capture the output of parent::speak(); and stop this function from echoing? Knowing that you can't change the 'Parent' class.