3v4l.org

run code in 300+ PHP versions simultaneously
<?php class obj { protected function protected_function(){ return true; } public function internal_is_callable(){ var_dump(is_callable([$this, "protected_function"])); } } $obj = new obj(); # If called from "outside" a class, is_callable() will return FALSE var_dump(is_callable([$obj, "protected_function"])); //returns bool(false) # Confusingly, if called from "inside" a class, is_callable() will return TRUE $obj->internal_is_callable(); //returns bool(true)
Output for git.master, git.master_jit, rfc.property-hooks
bool(false) bool(true)

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
30.2 ms | 401 KiB | 8 Q