3v4l.org

run code in 500+ PHP versions simultaneously
<?php $attribute_content[0]['term_id'] = 76; $attribute_content[0]['content'] = "ratio"; $attribute_content[1]['term_id'] = 18; $attribute_content[1]['content'] = "ideal condition"; $attribute_content[2]['term_id'] = 164; $attribute_content[2]['content'] = "genotype"; $attribute_content[3]['term_id'] = 218; $attribute_content[3]['content'] = "genetics"; $attribute_content[4]['term_id'] = 60; $attribute_content[4]['content'] = "height"; $order = array(18,164,218,60,76); $weights = array_flip($order); usort($attribute_content, function($x, $y) use($weights) { return $weights[$x['term_id']] - $weights[$y['term_id']]; }); var_dump($attribute_content);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oJhJs
function name:  (null)
number of ops:  45
compiled vars:  !0 = $attribute_content, !1 = $order, !2 = $weights
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   FETCH_DIM_W                                          $3      !0, 0
          1        ASSIGN_DIM                                                   $3, 'term_id'
          2        OP_DATA                                                      76
    4     3        FETCH_DIM_W                                          $5      !0, 0
          4        ASSIGN_DIM                                                   $5, 'content'
          5        OP_DATA                                                      'ratio'
    5     6        FETCH_DIM_W                                          $7      !0, 1
          7        ASSIGN_DIM                                                   $7, 'term_id'
          8        OP_DATA                                                      18
    6     9        FETCH_DIM_W                                          $9      !0, 1
         10        ASSIGN_DIM                                                   $9, 'content'
         11        OP_DATA                                                      'ideal+condition'
    7    12        FETCH_DIM_W                                          $11     !0, 2
         13        ASSIGN_DIM                                                   $11, 'term_id'
         14        OP_DATA                                                      164
    8    15        FETCH_DIM_W                                          $13     !0, 2
         16        ASSIGN_DIM                                                   $13, 'content'
         17        OP_DATA                                                      'genotype'
    9    18        FETCH_DIM_W                                          $15     !0, 3
         19        ASSIGN_DIM                                                   $15, 'term_id'
         20        OP_DATA                                                      218
   10    21        FETCH_DIM_W                                          $17     !0, 3
         22        ASSIGN_DIM                                                   $17, 'content'
         23        OP_DATA                                                      'genetics'
   11    24        FETCH_DIM_W                                          $19     !0, 4
         25        ASSIGN_DIM                                                   $19, 'term_id'
         26        OP_DATA                                                      60
   12    27        FETCH_DIM_W                                          $21     !0, 4
         28        ASSIGN_DIM                                                   $21, 'content'
         29        OP_DATA                                                      'height'
   14    30        ASSIGN                                                       !1, <array>
   16    31        INIT_FCALL                                                   'array_flip'
         32        SEND_VAR                                                     !1
         33        DO_ICALL                                             $24     
         34        ASSIGN                                                       !2, $24
   18    35        INIT_FCALL                                                   'usort'
         36        SEND_REF                                                     !0
         37        DECLARE_LAMBDA_FUNCTION                              ~26     [0]
         38        BIND_LEXICAL                                                 ~26, !2
   20    39        SEND_VAL                                                     ~26
   18    40        DO_ICALL                                                     
   22    41        INIT_FCALL                                                   'var_dump'
         42        SEND_VAR                                                     !0
         43        DO_ICALL                                                     
         44      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oJhJs
function name:  {closure:/in/oJhJs:18}
number of ops:  10
compiled vars:  !0 = $x, !1 = $y, !2 = $weights
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   18     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        BIND_STATIC                                                  !2
   19     3        FETCH_DIM_R                                          ~3      !0, 'term_id'
          4        FETCH_DIM_R                                          ~4      !2, ~3
          5        FETCH_DIM_R                                          ~5      !1, 'term_id'
          6        FETCH_DIM_R                                          ~6      !2, ~5
          7        SUB                                                  ~7      ~4, ~6
          8      > RETURN                                                       ~7
   20     9*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
162.21 ms | 2966 KiB | 16 Q