3v4l.org

run code in 300+ PHP versions simultaneously
<?php function a () { static $a = 0; function b() { static $b = 0; echo "I am ".__FUNCTION__.". I have been called ".$b++." times\n"; } echo "I am ".__FUNCTION__.". I have been called ".$a++." times\n"; } echo function_exists("b") ? "b is defined\n" : "b is not defined\n"; a(); echo function_exists("b") ? "b is defined\n" : "b is not defined\n"; b(); a(); echo function_exists("b") ? "b is defined\n" : "b is not defined\n";

preferences:
35.79 ms | 402 KiB | 5 Q