3v4l.org

run code in 300+ PHP versions simultaneously
<?php function is_magic($n, $arr = [1, 2, 10]) { return $n === $arr[0] || $n === ($arr[0] + $arr[1]) || ($n % $arr[2]) === ($arr[0] + $arr[1]); } $r = []; foreach([1, 3, 23, 32, 41, 54, 63] as $k => $n) { $r[$k] = is_magic($n); } var_dump($r);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 10
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/iI6ME
function name:  (null)
number of ops:  15
compiled vars:  !0 = $r, !1 = $n, !2 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                   !0, <array>
    8     1      > FE_RESET_R                                       $4      <array>, ->10
          2    > > FE_FETCH_R                                       ~5      $4, !1, ->10
          3    >   ASSIGN                                                   !2, ~5
    9     4        INIT_FCALL                                               'is_magic'
          5        SEND_VAR                                                 !1
          6        DO_FCALL                                      0  $8      
          7        ASSIGN_DIM                                               !0, !2
          8        OP_DATA                                                  $8
    8     9      > JMP                                                      ->2
         10    >   FE_FREE                                                  $4
   12    11        INIT_FCALL                                               'var_dump'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Function is_magic:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
2 jumps found. (Code = 47) Position 1 = 11, Position 2 = 18
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
Branch analysis from position: 10
filename:       /in/iI6ME
function name:  is_magic
number of ops:  20
compiled vars:  !0 = $n, !1 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <array>
    4     2        FETCH_DIM_R                                      ~2      !1, 0
          3        IS_IDENTICAL                                     ~3      !0, ~2
          4      > JMPNZ_EX                                         ~3      ~3, ->10
          5    >   FETCH_DIM_R                                      ~4      !1, 0
          6        FETCH_DIM_R                                      ~5      !1, 1
          7        ADD                                              ~6      ~4, ~5
          8        IS_IDENTICAL                                     ~7      !0, ~6
          9        BOOL                                             ~3      ~7
         10    > > JMPNZ_EX                                         ~3      ~3, ->18
         11    >   FETCH_DIM_R                                      ~8      !1, 2
         12        MOD                                              ~9      !0, ~8
         13        FETCH_DIM_R                                      ~10     !1, 0
         14        FETCH_DIM_R                                      ~11     !1, 1
         15        ADD                                              ~12     ~10, ~11
         16        IS_IDENTICAL                                     ~13     ~9, ~12
         17        BOOL                                             ~3      ~13
         18    > > RETURN                                                   ~3
    5    19*     > RETURN                                                   null

End of function is_magic

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.15 ms | 1403 KiB | 16 Q