Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Spawned {
- public $variable = 'test';
- }
- class Factory {
- public function create() {
- return new Spawned();
- }
- public function alter($object, $variable) {
- $object->variable = $variable;
- }
- }
- $factory = new Factory();
- $testobject = $factory->create();
- $factory->alter($testobject, 'bier');
- // Expected output: bier
- echo $testobject->variable;
- ?>
Add Comment
Please, Sign In to add comment