Skip to content

Instantly share code, notes, and snippets.

@mishak87
Created July 29, 2013 13:54
Show Gist options
  • Save mishak87/6104453 to your computer and use it in GitHub Desktop.
Save mishak87/6104453 to your computer and use it in GitHub Desktop.
PHP witch craft at its best?
<?php
class A {
public function callProtectedFunctionOfInstanceOfClassDescendant()
{
echo (new B)->protectedFunction();
}
}
class B extends A {
protected function protectedFunction()
{
return '1';
}
}
(new A)->callProtectedFunctionOfInstanceOfClassDescendant();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment