3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 0 => array ( 'category' => 'Sink', 'sublineitems' => array ( 0 => array ( 'quantity' => 1, 'model' => 'PBMS2016-12-X', 'customerspecificpricings' => array ( ), 'electricalutilitygrids' => array ( ), 'plumbingutilitygrids' => array ( 0 => array ( 'remarks' => '3-1/2" drain opening', ), ), 'subline_item_id' => '844b7c74-b1b7-4f17-a2da-f0c84cef432d', 'item_type_code' => 0, 'item_type_description' => 'Normal', 'vendor_id' => '4e1ab2ef-774e-4c73-be60-c937d1efeb56', ), ), 'lineitem_id' => 'e592feab-1e1a-4cfc-a97a-f1108c7156b6', 'item_number' => '1', ), ]; function sortByDataTypeRecursive(array &$array) { uasort($array, fn($a, $b) => is_array($a) <=> is_array($b)); //asort($array); foreach ($array as &$v) { if (is_array($v)) { (__FUNCTION__)($v); } } } sortByDataTypeRecursive($array); var_export($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kd3RT
function name:  (null)
number of ops:  8
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   49     1        INIT_FCALL                                               'sortbydatatyperecursive'
          2        SEND_REF                                                 !0
          3        DO_FCALL                                      0          
   50     4        INIT_FCALL                                               'var_export'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function sortbydatatyperecursive:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 7, Position 2 = 14
Branch analysis from position: 7
2 jumps found. (Code = 126) Position 1 = 8, Position 2 = 14
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 13
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 13
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/kd3RT
function name:  sortByDataTypeRecursive
number of ops:  16
compiled vars:  !0 = $array, !1 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E >   RECV                                             !0      
   40     1        INIT_FCALL                                               'uasort'
          2        SEND_REF                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
          4        SEND_VAL                                                 ~2
          5        DO_ICALL                                                 
   42     6      > FE_RESET_RW                                      $4      !0, ->14
          7    > > FE_FETCH_RW                                              $4, !1, ->14
   43     8    >   TYPE_CHECK                                  128          !1
          9      > JMPZ                                                     ~5, ->13
   44    10    >   INIT_FCALL_BY_NAME                                       'sortByDataTypeRecursive'
         11        SEND_VAR_EX                                              !1
         12        DO_FCALL                                      0          
   42    13    > > JMP                                                      ->7
         14    >   FE_FREE                                                  $4
   47    15      > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kd3RT
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        TYPE_CHECK                                  128  ~2      !0
          3        TYPE_CHECK                                  128  ~3      !1
          4        SPACESHIP                                        ~4      ~2, ~3
          5      > RETURN                                                   ~4
          6*     > RETURN                                                   null

End of Dynamic Function 0

End of function sortbydatatyperecursive

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.41 ms | 1013 KiB | 16 Q