3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getStaticVar($name, $t = false) { static $flags = array(); if(!isset($flags[$name])) { $flags[$name] = false; } if ($t) { $flags[$name] = true; } return (int)$flags[$name]; } $name = 'varName'; echo getStaticVar($name); echo getStaticVar($name, true); echo getStaticVar($name);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2T3MW
function name:  (null)
number of ops:  15
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   ASSIGN                                                   !0, 'varName'
   21     1        INIT_FCALL                                               'getstaticvar'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $2      
          4        ECHO                                                     $2
   22     5        INIT_FCALL                                               'getstaticvar'
          6        SEND_VAR                                                 !0
          7        SEND_VAL                                                 <true>
          8        DO_FCALL                                      0  $3      
          9        ECHO                                                     $3
   23    10        INIT_FCALL                                               'getstaticvar'
         11        SEND_VAR                                                 !0
         12        DO_FCALL                                      0  $4      
         13        ECHO                                                     $4
         14      > RETURN                                                   1

Function getstaticvar:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
Branch analysis from position: 8
filename:       /in/2T3MW
function name:  getStaticVar
number of ops:  15
compiled vars:  !0 = $name, !1 = $t, !2 = $flags
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <false>
    5     2        BIND_STATIC                                              !2
    7     3        ISSET_ISEMPTY_DIM_OBJ                         0  ~3      !2, !0
          4        BOOL_NOT                                         ~4      ~3
          5      > JMPZ                                                     ~4, ->8
    8     6    >   ASSIGN_DIM                                               !2, !0
          7        OP_DATA                                                  <false>
   12     8    > > JMPZ                                                     !1, ->11
   13     9    >   ASSIGN_DIM                                               !2, !0
         10        OP_DATA                                                  <true>
   16    11    >   FETCH_DIM_R                                      ~7      !2, !0
         12        CAST                                          4  ~8      ~7
         13      > RETURN                                                   ~8
   17    14*     > RETURN                                                   null

End of function getstaticvar

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.1 ms | 1399 KiB | 16 Q