3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function makeCounter() { $currentCount = 1; function counter() { return currentCount++; } counter.set = function(value) { currentCount = value; }; counter.reset = function() { currentCount = 1; }; return counter; // Интересует этот момент } var counter = makeCounter(); alert( counter() ); // 1 alert( counter() ); // 2 counter.set(5); alert( counter() ); // 5
based on trh1A
Output for 7.0.0 - 7.0.2
Parse error: syntax error, unexpected '++' (T_INC), expecting ';' in /in/XPgml on line 7
Process exited with code 255.
Output for 5.4.12 - 5.6.17
Parse error: syntax error, unexpected '++' (T_INC) in /in/XPgml on line 7
Process exited with code 255.
Output for 5.3.22 - 5.3.29
Parse error: syntax error, unexpected T_INC in /in/XPgml on line 7
Process exited with code 255.