3v4l.org

run code in 500+ PHP versions simultaneously
<?php $i = 0; function funsimple() { global $i; if (($i++ % 2_000) === 0) { var_dump($i); } funsimple(); } function fun() { array_map(function ($str) { global $i; if (($i++ % 2_000) === 0) { var_dump($i); } fun(); }, ['x']); } $fx = function () use (&$fx, &$i) { array_map(function ($str) use ($fx, &$i) { if (($i++ % 2_000) === 0) { var_dump($i); } $fx(); }, ['x']); }; // funsimple(); // this produces correctly OOM error // this produces segfault fun(); // $fx(); // using anonymous function, the behaviour is the same

Abusive script

This script was stopped while abusing our resources

Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jJD62
function name:  (null)
number of ops:  8
compiled vars:  !0 = $i, !1 = $fx
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 0
   24     1        DECLARE_LAMBDA_FUNCTION                              ~3      [0]
          2        BIND_LEXICAL                                                 ~3, !1
          3        BIND_LEXICAL                                                 ~3, !0
          4        ASSIGN                                                       !1, ~3
   37     5        INIT_FCALL                                                   'fun'
          6        DO_FCALL                                          0          
   38     7      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jJD62
function name:  {closure:/in/jJD62:24}
number of ops:  10
compiled vars:  !0 = $fx, !1 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   24     0  E >   BIND_STATIC                                                  !0
          1        BIND_STATIC                                                  !1
   25     2        INIT_FCALL                                                   'array_map'
          3        DECLARE_LAMBDA_FUNCTION                              ~2      [0]
          4        BIND_LEXICAL                                                 ~2, !0
          5        BIND_LEXICAL                                                 ~2, !1
   31     6        SEND_VAL                                                     ~2
          7        SEND_VAL                                                     <array>
   25     8        DO_ICALL                                                     
   32     9      > RETURN                                                       null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/jJD62
function name:  {closure:{closure:/in/jJD62:24}:25}
number of ops:  13
compiled vars:  !0 = $str, !1 = $fx, !2 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   25     0  E >   RECV                                                 !0      
          1        BIND_STATIC                                                  !1
          2        BIND_STATIC                                                  !2
   26     3        POST_INC                                             ~3      !2
          4        MOD                                                  ~4      ~3, 2000
          5        IS_IDENTICAL                                                 ~4, 0
          6      > JMPZ                                                         ~5, ->10
   27     7    >   INIT_FCALL                                                   'var_dump'
          8        SEND_VAR                                                     !2
          9        DO_ICALL                                                     
   30    10    >   INIT_DYNAMIC_CALL                                            !1
         11        DO_FCALL                                          0          
   31    12      > RETURN                                                       null

End of Dynamic Function 0

End of Dynamic Function 0

Function funsimple:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/jJD62
function name:  funsimple
number of ops:  11
compiled vars:  !0 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   BIND_GLOBAL                                                  !0, 'i'
    7     1        POST_INC                                             ~1      !0
          2        MOD                                                  ~2      ~1, 2000
          3        IS_IDENTICAL                                                 ~2, 0
          4      > JMPZ                                                         ~3, ->8
    8     5    >   INIT_FCALL                                                   'var_dump'
          6        SEND_VAR                                                     !0
          7        DO_ICALL                                                     
   10     8    >   INIT_FCALL_BY_NAME                                           'funsimple'
          9        DO_FCALL                                          0          
   11    10      > RETURN                                                       null

End of function funsimple

Function fun:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jJD62
function name:  fun
number of ops:  6
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                                   'array_map'
          1        DECLARE_LAMBDA_FUNCTION                              ~0      [0]
   21     2        SEND_VAL                                                     ~0
          3        SEND_VAL                                                     <array>
   14     4        DO_ICALL                                                     
   22     5      > RETURN                                                       null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 9
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/jJD62
function name:  {closure:fun():14}
number of ops:  12
compiled vars:  !0 = $str, !1 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   RECV                                                 !0      
   15     1        BIND_GLOBAL                                                  !1, 'i'
   16     2        POST_INC                                             ~2      !1
          3        MOD                                                  ~3      ~2, 2000
          4        IS_IDENTICAL                                                 ~3, 0
          5      > JMPZ                                                         ~4, ->9
   17     6    >   INIT_FCALL                                                   'var_dump'
          7        SEND_VAR                                                     !1
          8        DO_ICALL                                                     
   20     9    >   INIT_FCALL_BY_NAME                                           'fun'
         10        DO_FCALL                                          0          
   21    11      > RETURN                                                       null

End of Dynamic Function 0

End of function fun

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
160.47 ms | 2219 KiB | 16 Q