3v4l.org

run code in 300+ PHP versions simultaneously
<?php $masks = array( array('id'=>1, 'libelle'=>__('Transmissions')), array('id'=>2, 'libelle'=>__('Mouvements')), array('id'=>4, 'libelle'=>__('Messages')), array('id'=>8, 'libelle'=>__('Factures')), ); $value = 15; $key = 'id'; $values = array(); foreach ($masks AS $mask) { $m = $mask; if (is_array($mask)) $m = $mask[$key]; if (checkPermission($value, $m)) $values[] = $m; } var_dump($values); function checkPermission($user, $permission) { if($user & $permission) { return true; } else { return false; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 29, Position 2 = 43
Branch analysis from position: 29
2 jumps found. (Code = 78) Position 1 = 30, Position 2 = 43
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 35
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 42
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
Branch analysis from position: 42
Branch analysis from position: 35
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 43
filename:       /in/Pj1QM
function name:  (null)
number of ops:  48
compiled vars:  !0 = $masks, !1 = $value, !2 = $key, !3 = $values, !4 = $mask, !5 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_ARRAY                                       ~6      1, 'id'
          1        INIT_FCALL_BY_NAME                                       '__'
          2        SEND_VAL_EX                                              'Transmissions'
          3        DO_FCALL                                      0  $7      
          4        ADD_ARRAY_ELEMENT                                ~6      $7, 'libelle'
          5        INIT_ARRAY                                       ~8      ~6
    5     6        INIT_ARRAY                                       ~9      2, 'id'
          7        INIT_FCALL_BY_NAME                                       '__'
          8        SEND_VAL_EX                                              'Mouvements'
          9        DO_FCALL                                      0  $10     
         10        ADD_ARRAY_ELEMENT                                ~9      $10, 'libelle'
         11        ADD_ARRAY_ELEMENT                                ~8      ~9
    6    12        INIT_ARRAY                                       ~11     4, 'id'
         13        INIT_FCALL_BY_NAME                                       '__'
         14        SEND_VAL_EX                                              'Messages'
         15        DO_FCALL                                      0  $12     
         16        ADD_ARRAY_ELEMENT                                ~11     $12, 'libelle'
         17        ADD_ARRAY_ELEMENT                                ~8      ~11
    7    18        INIT_ARRAY                                       ~13     8, 'id'
         19        INIT_FCALL_BY_NAME                                       '__'
         20        SEND_VAL_EX                                              'Factures'
         21        DO_FCALL                                      0  $14     
         22        ADD_ARRAY_ELEMENT                                ~13     $14, 'libelle'
         23        ADD_ARRAY_ELEMENT                                ~8      ~13
    3    24        ASSIGN                                                   !0, ~8
    9    25        ASSIGN                                                   !1, 15
   10    26        ASSIGN                                                   !2, 'id'
   11    27        ASSIGN                                                   !3, <array>
   12    28      > FE_RESET_R                                       $19     !0, ->43
         29    > > FE_FETCH_R                                               $19, !4, ->43
   14    30    >   ASSIGN                                                   !5, !4
   15    31        TYPE_CHECK                                  128          !4
         32      > JMPZ                                                     ~21, ->35
   16    33    >   FETCH_DIM_R                                      ~22     !4, !2
         34        ASSIGN                                                   !5, ~22
   17    35    >   INIT_FCALL_BY_NAME                                       'checkPermission'
         36        SEND_VAR_EX                                              !1
         37        SEND_VAR_EX                                              !5
         38        DO_FCALL                                      0  $24     
         39      > JMPZ                                                     $24, ->42
   18    40    >   ASSIGN_DIM                                               !3
         41        OP_DATA                                                  !5
   12    42    > > JMP                                                      ->29
         43    >   FE_FREE                                                  $19
   20    44        INIT_FCALL                                               'var_dump'
         45        SEND_VAR                                                 !3
         46        DO_ICALL                                                 
   27    47      > RETURN                                                   1

Function checkpermission:
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/Pj1QM
function name:  checkPermission
number of ops:  8
compiled vars:  !0 = $user, !1 = $permission
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   22     2        BW_AND                                           ~2      !0, !1
          3      > JMPZ                                                     ~2, ->6
   23     4    > > RETURN                                                   <true>
          5*       JMP                                                      ->7
   25     6    > > RETURN                                                   <false>
   27     7*     > RETURN                                                   null

End of function checkpermission

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.65 ms | 945 KiB | 16 Q