3v4l.org

run code in 500+ PHP versions simultaneously
<?php $json = array ( 0 => array ( 'query' => 'SELECT 4.4 AS valor FROM DUAL WHERE 60000 BETWEEN 0 AND 60000', 'operador' => 'BETWEEN', 'idcaracteristica' => '185', ), 1 => array ( 'query' => '1 IN (1,2,3,4,5,6,7,8,13,15,16)', 'operador' => 'IN', 'idcaracteristica' => '185', ), 2 => array ( 'query' => 'SELECT 2.95 AS valor FROM DUAL WHERE 60000 BETWEEN 100001 AND 150000', 'operador' => 'BETWEEN', 'idcaracteristica' => '186', ), 3 => array ( 'query' => '1 IN (1,2,3,4,5,6,7,8,13,15,16)', 'operador' => 'IN', 'idcaracteristica' => '186', ) ); $final = array_reduce($json, function($carry, $input ){ $key = $input['idcaracteristica']; if( isset($carry[$key])) { $carry[$key] .= ' AND '.$input['query']; } else { $carry[$key] = $input['query']; } return $carry; }, []); print_r($final);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CecZJ
function name:  (null)
number of ops:  12
compiled vars:  !0 = $json, !1 = $final
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   30     1        INIT_FCALL                                                   'array_reduce'
          2        SEND_VAR                                                     !0
          3        DECLARE_LAMBDA_FUNCTION                              ~3      [0]
   38     4        SEND_VAL                                                     ~3
          5        SEND_VAL                                                     <array>
   30     6        DO_ICALL                                             $4      
          7        ASSIGN                                                       !1, $4
   40     8        INIT_FCALL                                                   'print_r'
          9        SEND_VAR                                                     !1
         10        DO_ICALL                                                     
         11      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CecZJ
function name:  {closure:/in/CecZJ:30}
number of ops:  16
compiled vars:  !0 = $carry, !1 = $input, !2 = $key
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   30     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   31     2        FETCH_DIM_R                                          ~3      !1, 'idcaracteristica'
          3        ASSIGN                                                       !2, ~3
   32     4        ISSET_ISEMPTY_DIM_OBJ                             0          !0, !2
          5      > JMPZ                                                         ~5, ->11
   33     6    >   FETCH_DIM_R                                          ~7      !1, 'query'
          7        CONCAT                                               ~8      '+AND+', ~7
          8        ASSIGN_DIM_OP                    .=               8          !0, !2
          9        OP_DATA                                                      ~8
   32    10      > JMP                                                          ->14
   35    11    >   FETCH_DIM_R                                          ~10     !1, 'query'
         12        ASSIGN_DIM                                                   !0, !2
         13        OP_DATA                                                      ~10
   37    14    > > RETURN                                                       !0
   38    15*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
127.75 ms | 488 KiB | 11 Q