3v4l.org

run code in 300+ PHP versions simultaneously
<?php $entity = new stdClass(); $entity->price['und'][] = array('amount' => 0, 'currency_code' => 'CAD', 'data' => FALSE); $entity->price2['und'][] = array('amount' => 0, 'currency_code' => 'CAD', 'data' => FALSE); function compare_filter($field, $array) { foreach ($array as $language => $items) { if (empty($items)) { unset($array[$language]); } else { foreach ($items as $delta => $item) { $array[$language][$delta] = array_filter(array_intersect_key($item, $field['columns'])); ksort($array[$language][$delta]); } } } return $array; } $field['columns'] = array('amount' => array(), 'currency_code' => array(), 'data' => array()); foreach (array('price', 'price2') as $field_name) { $items1 = compare_filter($field, (array) $entity->$field_name); } var_dump($entity);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 23
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 23
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/WDqKN
function name:  (null)
number of ops:  28
compiled vars:  !0 = $entity, !1 = $field, !2 = $field_name, !3 = $items1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $4      'stdClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
    4     3        FETCH_OBJ_W                                      $7      !0, 'price'
          4        FETCH_DIM_W                                      $8      $7, 'und'
          5        ASSIGN_DIM                                               $8
          6        OP_DATA                                                  <array>
    5     7        FETCH_OBJ_W                                      $10     !0, 'price2'
          8        FETCH_DIM_W                                      $11     $10, 'und'
          9        ASSIGN_DIM                                               $11
         10        OP_DATA                                                  <array>
   22    11        ASSIGN_DIM                                               !1, 'columns'
         12        OP_DATA                                                  <array>
   23    13      > FE_RESET_R                                       $14     <array>, ->23
         14    > > FE_FETCH_R                                               $14, !2, ->23
   24    15    >   INIT_FCALL                                               'compare_filter'
         16        SEND_VAR                                                 !1
         17        FETCH_OBJ_R                                      ~15     !0, !2
         18        CAST                                          7  ~16     ~15
         19        SEND_VAL                                                 ~16
         20        DO_FCALL                                      0  $17     
         21        ASSIGN                                                   !3, $17
   23    22      > JMP                                                      ->14
         23    >   FE_FREE                                                  $14
   27    24        INIT_FCALL                                               'var_dump'
         25        SEND_VAR                                                 !0
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

Function compare_filter:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 31
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 31
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 9
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 29
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 29
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 29
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
filename:       /in/WDqKN
function name:  compare_filter
number of ops:  34
compiled vars:  !0 = $field, !1 = $array, !2 = $items, !3 = $language, !4 = $item, !5 = $delta
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    8     2      > FE_RESET_R                                       $6      !1, ->31
          3    > > FE_FETCH_R                                       ~7      $6, !2, ->31
          4    >   ASSIGN                                                   !3, ~7
    9     5        ISSET_ISEMPTY_CV                                         !2
          6      > JMPZ                                                     ~9, ->9
   10     7    >   UNSET_DIM                                                !1, !3
          8      > JMP                                                      ->30
   13     9    > > FE_RESET_R                                       $10     !2, ->29
         10    > > FE_FETCH_R                                       ~11     $10, !4, ->29
         11    >   ASSIGN                                                   !5, ~11
   14    12        INIT_FCALL                                               'array_filter'
         13        INIT_FCALL                                               'array_intersect_key'
         14        SEND_VAR                                                 !4
         15        FETCH_DIM_R                                      ~15     !0, 'columns'
         16        SEND_VAL                                                 ~15
         17        DO_ICALL                                         $16     
         18        SEND_VAR                                                 $16
         19        DO_ICALL                                         $17     
         20        FETCH_DIM_W                                      $13     !1, !3
         21        ASSIGN_DIM                                               $13, !5
         22        OP_DATA                                                  $17
   15    23        INIT_FCALL                                               'ksort'
         24        FETCH_DIM_W                                      $18     !1, !3
         25        FETCH_DIM_W                                      $19     $18, !5
         26        SEND_REF                                                 $19
         27        DO_ICALL                                                 
   13    28      > JMP                                                      ->10
         29    >   FE_FREE                                                  $10
    8    30    > > JMP                                                      ->3
         31    >   FE_FREE                                                  $6
   19    32      > RETURN                                                   !1
   20    33*     > RETURN                                                   null

End of function compare_filter

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.37 ms | 1403 KiB | 22 Q