Skip to content

Instantly share code, notes, and snippets.

@dstogov
Created October 6, 2021 11:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dstogov/bfb027472ece7d12a14b8a4a0b1162a3 to your computer and use it in GitHub Desktop.
Save dstogov/bfb027472ece7d12a14b8a4a0b1162a3 to your computer and use it in GitHub Desktop.
<?php
class A {
public $prop = "x";
function foo() {
var_dump("A");
return $this->prop;
}
function bar() {
$x = $this->foo();
var_dump(str_repeat($x,5));
}
}
class B extends A {
function &foo() {
var_dump("B");
return $this->prop;
}
}
$b = new B;
$b->bar();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment