3v4l.org

run code in 300+ PHP versions simultaneously
<?php function is_even(int $n): bool { $fn = null; $fn = fn(int $nr, bool $not): bool => $nr === 0 ? !$not : $fn(($nr < 0 ? abs($nr) : $nr) - 1, !$not); return $fn($n, false); } for($i = -5; $i <= 12; $i++) { printf('is %d even? %s.%s', $i, is_even($i) ? 'yes': 'no', "\n"); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 2
Branch analysis from position: 18
Branch analysis from position: 2
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 2
Branch analysis from position: 18
Branch analysis from position: 2
filename:       /in/2WBFO
function name:  (null)
number of ops:  19
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN                                                   !0, -5
          1      > JMP                                                      ->16
   11     2    >   INIT_FCALL                                               'printf'
          3        SEND_VAL                                                 'is+%25d+even%3F+%25s.%25s'
          4        SEND_VAR                                                 !0
          5        INIT_FCALL                                               'is_even'
          6        SEND_VAR                                                 !0
          7        DO_FCALL                                      0  $2      
          8      > JMPZ                                                     $2, ->11
          9    >   QM_ASSIGN                                        ~3      'yes'
         10      > JMP                                                      ->12
         11    >   QM_ASSIGN                                        ~3      'no'
         12    >   SEND_VAL                                                 ~3
         13        SEND_VAL                                                 '%0A'
         14        DO_ICALL                                                 
   10    15        PRE_INC                                                  !0
         16    >   IS_SMALLER_OR_EQUAL                                      !0, 12
         17      > JMPNZ                                                    ~6, ->2
   12    18    > > RETURN                                                   1

Function is_even:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2WBFO
function name:  is_even
number of ops:  13
compiled vars:  !0 = $n, !1 = $fn
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, null
    5     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F2WBFO%3A5%240'
          3        BIND_LEXICAL                                             ~3, !1
          4        ASSIGN                                                   !1, ~3
    7     5        INIT_DYNAMIC_CALL                                        !1
          6        SEND_VAR_EX                                              !0
          7        SEND_VAL_EX                                              <false>
          8        DO_FCALL                                      0  $5      
          9        VERIFY_RETURN_TYPE                                       $5
         10      > RETURN                                                   $5
    8    11*       VERIFY_RETURN_TYPE                                       
         12*     > RETURN                                                   null

End of function is_even

Function %00%7Bclosure%7D%2Fin%2F2WBFO%3A5%240:
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 = 42) Position 1 = 23
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 16
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2WBFO
function name:  {closure}
number of ops:  27
compiled vars:  !0 = $nr, !1 = $not, !2 = $fn
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
          3        IS_IDENTICAL                                             !0, 0
          4      > JMPZ                                                     ~3, ->8
          5    >   BOOL_NOT                                         ~4      !1
          6        QM_ASSIGN                                        ~5      ~4
          7      > JMP                                                      ->23
          8    >   INIT_DYNAMIC_CALL                                        !2
          9        IS_SMALLER                                               !0, 0
         10      > JMPZ                                                     ~6, ->16
         11    >   INIT_FCALL                                               'abs'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                         $7      
         14        QM_ASSIGN                                        ~8      $7
         15      > JMP                                                      ->17
         16    >   QM_ASSIGN                                        ~8      !0
         17    >   SUB                                              ~9      ~8, 1
         18        SEND_VAL_EX                                              ~9
         19        BOOL_NOT                                         ~10     !1
         20        SEND_VAL_EX                                              ~10
         21        DO_FCALL                                      0  $11     
         22        QM_ASSIGN                                        ~5      $11
         23    >   VERIFY_RETURN_TYPE                                       ~5
         24      > RETURN                                                   ~5
         25*       VERIFY_RETURN_TYPE                                       
         26*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F2WBFO%3A5%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.54 ms | 1403 KiB | 18 Q