3v4l.org

run code in 300+ PHP versions simultaneously
<?php $report = array ( '18427e904f7a227e8c3b80dd2858a70e' => array ( 'needle' => array ( 0 => array ( 'starts_at' => 11821, 'ends_at' => 14377, 'length' => 2556, 'original' => 'foo' ), ), 'haystack' => array ( 0 => array ( 'starts_at' => 12227, 'ends_at' => 14783, 'length' => 2556, 'original' => 'foo' ), ), ), 'dd0c26f35ebf55de25eabea3edbfba32' => array ( 'needle' => array ( 0 => array ( 'starts_at' => 17255, 'ends_at' => 32431, 'length' => 15176, 'original' => 'foo' ), ), 'haystack' => array ( 0 => array ( 'starts_at' => 17776, 'ends_at' => 33032, 'length' => 15256, 'original' => 'foo' ), ), )); var_dump(remapMatches($report, true)); function remapMatches($matches) { $remapped = []; foreach ($matches as $fingerprint => $match) { $remapped[$fingerprint] = $match; $needle = $remapped[$fingerprint]['needle']; $haystack = $remapped[$fingerprint]['haystack']; unset($needle); unset($haystack); foreach ($remapped[$fingerprint]['needle'] as &$needle) unset($needle['original']); foreach ($remapped[$fingerprint]['haystack'] as &$haystack) unset($haystack['original']); } return $remapped; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h6d0G
function name:  (null)
number of ops:  9
compiled vars:  !0 = $report
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   54     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL_BY_NAME                                       'remapMatches'
          3        SEND_VAR_EX                                              !0
          4        SEND_VAL_EX                                              <true>
          5        DO_FCALL                                      0  $2      
          6        SEND_VAR                                                 $2
          7        DO_ICALL                                                 
   81     8      > RETURN                                                   1

Function remapmatches:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 30
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 30
Branch analysis from position: 4
2 jumps found. (Code = 125) Position 1 = 18, Position 2 = 21
Branch analysis from position: 18
2 jumps found. (Code = 126) Position 1 = 19, Position 2 = 21
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 21
2 jumps found. (Code = 125) Position 1 = 25, Position 2 = 28
Branch analysis from position: 25
2 jumps found. (Code = 126) Position 1 = 26, Position 2 = 28
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 28
Branch analysis from position: 21
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
filename:       /in/h6d0G
function name:  remapMatches
number of ops:  33
compiled vars:  !0 = $matches, !1 = $remapped, !2 = $match, !3 = $fingerprint, !4 = $needle, !5 = $haystack
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   57     0  E >   RECV                                             !0      
   59     1        ASSIGN                                                   !1, <array>
   61     2      > FE_RESET_R                                       $7      !0, ->30
          3    > > FE_FETCH_R                                       ~8      $7, !2, ->30
          4    >   ASSIGN                                                   !3, ~8
   63     5        ASSIGN_DIM                                               !1, !3
          6        OP_DATA                                                  !2
   65     7        FETCH_DIM_R                                      ~11     !1, !3
          8        FETCH_DIM_R                                      ~12     ~11, 'needle'
          9        ASSIGN                                                   !4, ~12
   66    10        FETCH_DIM_R                                      ~14     !1, !3
         11        FETCH_DIM_R                                      ~15     ~14, 'haystack'
         12        ASSIGN                                                   !5, ~15
   68    13        UNSET_CV                                                 !4
   69    14        UNSET_CV                                                 !5
   71    15        FETCH_DIM_W                                      $17     !1, !3
         16        FETCH_DIM_W                                      $18     $17, 'needle'
         17      > FE_RESET_RW                                      $19     $18, ->21
         18    > > FE_FETCH_RW                                              $19, !4, ->21
   72    19    >   UNSET_DIM                                                !4, 'original'
   71    20      > JMP                                                      ->18
         21    >   FE_FREE                                                  $19
   74    22        FETCH_DIM_W                                      $20     !1, !3
         23        FETCH_DIM_W                                      $21     $20, 'haystack'
         24      > FE_RESET_RW                                      $22     $21, ->28
         25    > > FE_FETCH_RW                                              $22, !5, ->28
   75    26    >   UNSET_DIM                                                !5, 'original'
   74    27      > JMP                                                      ->25
         28    >   FE_FREE                                                  $22
   61    29      > JMP                                                      ->3
         30    >   FE_FREE                                                  $7
   80    31      > RETURN                                                   !1
   81    32*     > RETURN                                                   null

End of function remapmatches

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.07 ms | 1405 KiB | 15 Q