3v4l.org

run code in 300+ PHP versions simultaneously
<?php $profiles = [ 'entity_weight_boost' => [ 'score_mode' => 'sum', 'functions' => [ [ // Incoming links: k = 100, since it is normal to have a bunch of incoming links 'type' => 'satu', 'weight' => '0.6', 'params' => [ 'field' => 'incoming_links', 'missing' => 0, 'a' => 1 , 'k' => 100 ] ], [ // Site links: k = 20, tens of sites is a lot 'type' => 'satu', 'weight' => '0.4', 'params' => [ 'field' => 'sitelink_count', 'missing' => 0, 'a' => 2, 'k' => 20 ] ], [ // (De)boosting by statement values 'type' => 'term_boost', 'weight' => 0.1, 'params' => [ 'statement_keywords' => [ // Q4167410=Wikimedia disambiguation page 'P31=Q4167410' => -10, // T183510: // Q13442814=scientific article 'P31=Q13442814' => -5, // Q18918145=academic journal article 'P31=Q18918145' => -5, ] ] ] ], ], ]; $overrides = [ 'entity_weight_boost.functions.2.params.statement_keywords' => 'SomeOverride' ]; function setDotted(array $path, &$arg, $val) { $key = array_shift($path); if (!isset($arg[$key])) { return; } if (count($path) === 0) { $arg[$key] = $val; } else { setDotted($path, $arg[$key], $val); } } foreach ( $overrides as $path => $configVar ) { setDotted(explode(".", $path), $profiles, ['a' => 1]); } var_dump($profiles);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 15
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 15
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/NtpGE
function name:  (null)
number of ops:  20
compiled vars:  !0 = $profiles, !1 = $overrides, !2 = $configVar, !3 = $path
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   39     1        ASSIGN                                                   !1, <array>
   55     2      > FE_RESET_R                                       $6      !1, ->15
          3    > > FE_FETCH_R                                       ~7      $6, !2, ->15
          4    >   ASSIGN                                                   !3, ~7
   56     5        INIT_FCALL                                               'setdotted'
          6        INIT_FCALL                                               'explode'
          7        SEND_VAL                                                 '.'
          8        SEND_VAR                                                 !3
          9        DO_ICALL                                         $9      
         10        SEND_VAR                                                 $9
         11        SEND_REF                                                 !0
         12        SEND_VAL                                                 <array>
         13        DO_FCALL                                      0          
   55    14      > JMP                                                      ->3
         15    >   FE_FREE                                                  $6
   58    16        INIT_FCALL                                               'var_dump'
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Function setdotted:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 11
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 17
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NtpGE
function name:  setDotted
number of ops:  25
compiled vars:  !0 = $path, !1 = $arg, !2 = $val, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   43     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   44     3        INIT_FCALL                                               'array_shift'
          4        SEND_REF                                                 !0
          5        DO_ICALL                                         $4      
          6        ASSIGN                                                   !3, $4
   45     7        ISSET_ISEMPTY_DIM_OBJ                         0  ~6      !1, !3
          8        BOOL_NOT                                         ~7      ~6
          9      > JMPZ                                                     ~7, ->11
   46    10    > > RETURN                                                   null
   48    11    >   COUNT                                            ~8      !0
         12        IS_IDENTICAL                                             ~8, 0
         13      > JMPZ                                                     ~9, ->17
   49    14    >   ASSIGN_DIM                                               !1, !3
         15        OP_DATA                                                  !2
         16      > JMP                                                      ->24
   51    17    >   INIT_FCALL_BY_NAME                                       'setDotted'
         18        SEND_VAR_EX                                              !0
         19        CHECK_FUNC_ARG                                           
         20        FETCH_DIM_FUNC_ARG                               $11     !1, !3
         21        SEND_FUNC_ARG                                            $11
         22        SEND_VAR_EX                                              !2
         23        DO_FCALL                                      0          
   53    24    > > RETURN                                                   null

End of function setdotted

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.83 ms | 1403 KiB | 20 Q