3v4l.org

run code in 300+ PHP versions simultaneously
<?php $elem1 = array('name' => 'one' , 'score' => 123); $elem2 = array('name' => 'twei', 'score' => 235); $elem3 = array('name' => 'yoo', 'score' => 12); $data = [$elem1, $elem2, $elem3]; sortByValue($data, 'score'); function sortByValue($array, $value) { $temp = []; foreach($array as $i => $elem) { $temp[$i] = $elem[$value]; } arsort($temp); var_dump($temp); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kvoO0
function name:  (null)
number of ops:  12
compiled vars:  !0 = $elem1, !1 = $elem2, !2 = $elem3, !3 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    5     2        ASSIGN                                                   !2, <array>
    7     3        INIT_ARRAY                                       ~7      !0
          4        ADD_ARRAY_ELEMENT                                ~7      !1
          5        ADD_ARRAY_ELEMENT                                ~7      !2
          6        ASSIGN                                                   !3, ~7
    8     7        INIT_FCALL_BY_NAME                                       'sortByValue'
          8        SEND_VAR_EX                                              !3
          9        SEND_VAL_EX                                              'score'
         10        DO_FCALL                                      0          
   18    11      > RETURN                                                   1

Function sortbyvalue:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 10
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/kvoO0
function name:  sortByValue
number of ops:  18
compiled vars:  !0 = $array, !1 = $value, !2 = $temp, !3 = $elem, !4 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   11     2        ASSIGN                                                   !2, <array>
   12     3      > FE_RESET_R                                       $6      !0, ->10
          4    > > FE_FETCH_R                                       ~7      $6, !3, ->10
          5    >   ASSIGN                                                   !4, ~7
   13     6        FETCH_DIM_R                                      ~10     !3, !1
          7        ASSIGN_DIM                                               !2, !4
          8        OP_DATA                                                  ~10
   12     9      > JMP                                                      ->4
         10    >   FE_FREE                                                  $6
   15    11        INIT_FCALL                                               'arsort'
         12        SEND_REF                                                 !2
         13        DO_ICALL                                                 
   16    14        INIT_FCALL                                               'var_dump'
         15        SEND_VAR                                                 !2
         16        DO_ICALL                                                 
   18    17      > RETURN                                                   null

End of function sortbyvalue

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.2 ms | 1396 KiB | 17 Q