3v4l.org

run code in 300+ PHP versions simultaneously
<?php $object1 = new stdClass(); $object1->id = 1; $object1->nome = 'B'; $object2 = new stdClass(); $object2->id = 1; $object2->nome = 'A'; $dados = array($object1, $object2); function orderData(array $data, $orderByField = 'nome') { $asc = array(); foreach ($data as $key1 => $object1) { $field1 = $object1->{$orderByField}; foreach ($data as $key2 => $object2) { $field2 = $object2->{$orderByField}; if ($field1 == $field2) { $asc[$key1] = $object2; } } } return $asc; } var_dump( orderData($dados) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oQrmf
function name:  (null)
number of ops:  24
compiled vars:  !0 = $object1, !1 = $object2, !2 = $dados
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $3      'stdClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
    4     3        ASSIGN_OBJ                                               !0, 'id'
          4        OP_DATA                                                  1
    5     5        ASSIGN_OBJ                                               !0, 'nome'
          6        OP_DATA                                                  'B'
    7     7        NEW                                              $8      'stdClass'
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $8
    8    10        ASSIGN_OBJ                                               !1, 'id'
         11        OP_DATA                                                  1
    9    12        ASSIGN_OBJ                                               !1, 'nome'
         13        OP_DATA                                                  'A'
   11    14        INIT_ARRAY                                       ~13     !0
         15        ADD_ARRAY_ELEMENT                                ~13     !1
         16        ASSIGN                                                   !2, ~13
   31    17        INIT_FCALL                                               'var_dump'
         18        INIT_FCALL                                               'orderdata'
         19        SEND_VAR                                                 !2
         20        DO_FCALL                                      0  $15     
         21        SEND_VAR                                                 $15
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

Function orderdata:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 20
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 20
Branch analysis from position: 5
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 18
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 18
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 17
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 17
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 18
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/oQrmf
function name:  orderData
number of ops:  23
compiled vars:  !0 = $data, !1 = $orderByField, !2 = $asc, !3 = $object1, !4 = $key1, !5 = $field1, !6 = $object2, !7 = $key2, !8 = $field2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      'nome'
   14     2        ASSIGN                                                   !2, <array>
   16     3      > FE_RESET_R                                       $10     !0, ->20
          4    > > FE_FETCH_R                                       ~11     $10, !3, ->20
          5    >   ASSIGN                                                   !4, ~11
   17     6        FETCH_OBJ_R                                      ~13     !3, !1
          7        ASSIGN                                                   !5, ~13
   19     8      > FE_RESET_R                                       $15     !0, ->18
          9    > > FE_FETCH_R                                       ~16     $15, !6, ->18
         10    >   ASSIGN                                                   !7, ~16
   20    11        FETCH_OBJ_R                                      ~18     !6, !1
         12        ASSIGN                                                   !8, ~18
   22    13        IS_EQUAL                                                 !5, !8
         14      > JMPZ                                                     ~20, ->17
   23    15    >   ASSIGN_DIM                                               !2, !4
         16        OP_DATA                                                  !6
   19    17    > > JMP                                                      ->9
         18    >   FE_FREE                                                  $15
   16    19      > JMP                                                      ->4
         20    >   FE_FREE                                                  $10
   28    21      > RETURN                                                   !2
   29    22*     > RETURN                                                   null

End of function orderdata

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.5 ms | 1403 KiB | 16 Q