3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function g($txt = '') { $goal = 'g'; $_g = function($str = '') use ($goal, $_g) { if ($str) { return $goal . $str; } $goal .= 'o'; return $_g; }; return $_g($txt); } echo (g())('al');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mWag5
function name:  (null)
number of ops:  8
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   2     0  E >   NOP                                                      
  16     1        INIT_FCALL                                               'g'
         2        DO_FCALL                                      0  $0      
         3        INIT_DYNAMIC_CALL                                        $0
         4        SEND_VAL_EX                                              'al'
         5        DO_FCALL                                      0  $1      
         6        ECHO                                                     $1
         7      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FmWag50x7ff4dfd810a4:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mWag5
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $str, !1 = $goal, !2 = $_g
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   5     0  E >   RECV_INIT                                        !0      ''
         1        BIND_STATIC                                              !1, 'goal'
         2        BIND_STATIC                                              !2, '_g'
   6     3      > JMPZ                                                     !0, ->6
   7     4    >   CONCAT                                           ~3      !1, !0
         5      > RETURN                                                   ~3
   9     6    >   ASSIGN_CONCAT                                 0          !1, 'o'
  10     7      > RETURN                                                   !2
  11     8*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FmWag50x7ff4dfd810a4

Function g:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mWag5
function name:  g
number of ops:  11
compiled vars:  !0 = $txt, !1 = $goal, !2 = $_g
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   2     0  E >   RECV_INIT                                        !0      ''
   3     1        ASSIGN                                                   !1, 'g'
   5     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FmWag50x7ff4dfd810a4'
         3        BIND_LEXICAL                                             ~4, !1
         4        BIND_LEXICAL                                             ~4, !2
  11     5        ASSIGN                                                   !2, ~4
  13     6        INIT_DYNAMIC_CALL                                        !2
         7        SEND_VAR_EX                                              !0
         8        DO_FCALL                                      0  $6      
         9      > RETURN                                                   $6
  14    10*     > RETURN                                                   null

End of function g

Generated using Vulcan Logic Dumper, using php 7.3.0