3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( 0 => array( "label"=>"Ai", "male"=>0, "female"=>10 ), 1=> array( "label"=>"Bi", "male"=>0, "female"=>20 ), 2=> array( "label"=>"Ci", "male"=>10, "female"=>20 ) ); $min = min(array_column($array,'male')); $keys = array_keys(array_column($array,'male'), $min); $finalArray =[]; foreach($keys as $key){ $finalArray[] = array( 'label'=>$array[$key]['label'], 'male'=>$array[$key]['male'] ); } print_r($finalArray);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 20, Position 2 = 30
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 30
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
filename:       /in/DSfFK
function name:  (null)
number of ops:  35
compiled vars:  !0 = $array, !1 = $min, !2 = $keys, !3 = $finalArray, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   20     1        INIT_FCALL                                               'min'
          2        INIT_FCALL                                               'array_column'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 'male'
          5        DO_ICALL                                         $6      
          6        SEND_VAR                                                 $6
          7        DO_ICALL                                         $7      
          8        ASSIGN                                                   !1, $7
   22     9        INIT_FCALL                                               'array_keys'
         10        INIT_FCALL                                               'array_column'
         11        SEND_VAR                                                 !0
         12        SEND_VAL                                                 'male'
         13        DO_ICALL                                         $9      
         14        SEND_VAR                                                 $9
         15        SEND_VAR                                                 !1
         16        DO_ICALL                                         $10     
         17        ASSIGN                                                   !2, $10
   24    18        ASSIGN                                                   !3, <array>
   25    19      > FE_RESET_R                                       $13     !2, ->30
         20    > > FE_FETCH_R                                               $13, !4, ->30
   27    21    >   FETCH_DIM_R                                      ~15     !0, !4
         22        FETCH_DIM_R                                      ~16     ~15, 'label'
         23        INIT_ARRAY                                       ~17     ~16, 'label'
   28    24        FETCH_DIM_R                                      ~18     !0, !4
         25        FETCH_DIM_R                                      ~19     ~18, 'male'
         26        ADD_ARRAY_ELEMENT                                ~17     ~19, 'male'
   26    27        ASSIGN_DIM                                               !3
   28    28        OP_DATA                                                  ~17
   25    29      > JMP                                                      ->20
         30    >   FE_FREE                                                  $13
   33    31        INIT_FCALL                                               'print_r'
         32        SEND_VAR                                                 !3
         33        DO_ICALL                                                 
         34      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.45 ms | 1006 KiB | 17 Q