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) { $alphabetic = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'x', 'z'); $asc = array(); $i = 0; $total = count($data); foreach ($alphabetic as $keyAlpha => $valueAlpha) { if ($i == $total) { break; } foreach ($data as $key => $value) { $letter = $value->nome; $letter = $letter['0']; if ($valueAlpha == $letter || strtoupper($letter) == strtoupper($letter)) { $asc[$key] = $value; } } ++$i; } return $asc; } var_dump( orderData($dados) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/S60DG
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
   41    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 = 7, Position 2 = 36
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 36
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 33
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 33
Branch analysis from position: 14
2 jumps found. (Code = 47) Position 1 = 21, Position 2 = 29
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 32
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 32
Branch analysis from position: 29
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 33
Branch analysis from position: 36
Branch analysis from position: 36
filename:       /in/S60DG
function name:  orderData
number of ops:  39
compiled vars:  !0 = $data, !1 = $alphabetic, !2 = $asc, !3 = $i, !4 = $total, !5 = $valueAlpha, !6 = $keyAlpha, !7 = $value, !8 = $key, !9 = $letter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   14     1        ASSIGN                                                   !1, <array>
   15     2        ASSIGN                                                   !2, <array>
   17     3        ASSIGN                                                   !3, 0
   18     4        COUNT                                            ~13     !0
          5        ASSIGN                                                   !4, ~13
   20     6      > FE_RESET_R                                       $15     !1, ->36
          7    > > FE_FETCH_R                                       ~16     $15, !5, ->36
          8    >   ASSIGN                                                   !6, ~16
   22     9        IS_EQUAL                                                 !3, !4
         10      > JMPZ                                                     ~18, ->12
   23    11    > > JMP                                                      ->36
   26    12    > > FE_RESET_R                                       $19     !0, ->33
         13    > > FE_FETCH_R                                       ~20     $19, !7, ->33
         14    >   ASSIGN                                                   !8, ~20
   27    15        FETCH_OBJ_R                                      ~22     !7, 'nome'
         16        ASSIGN                                                   !9, ~22
   28    17        FETCH_DIM_R                                      ~24     !9, 0
         18        ASSIGN                                                   !9, ~24
   30    19        IS_EQUAL                                         ~26     !5, !9
         20      > JMPNZ_EX                                         ~26     ~26, ->29
         21    >   INIT_FCALL                                               'strtoupper'
         22        SEND_VAR                                                 !9
         23        DO_ICALL                                         $27     
         24        INIT_FCALL                                               'strtoupper'
         25        SEND_VAR                                                 !9
         26        DO_ICALL                                         $28     
         27        IS_EQUAL                                         ~29     $27, $28
         28        BOOL                                             ~26     ~29
         29    > > JMPZ                                                     ~26, ->32
   31    30    >   ASSIGN_DIM                                               !2, !8
         31        OP_DATA                                                  !7
   26    32    > > JMP                                                      ->13
         33    >   FE_FREE                                                  $19
   35    34        PRE_INC                                                  !3
   20    35      > JMP                                                      ->7
         36    >   FE_FREE                                                  $15
   38    37      > RETURN                                                   !2
   39    38*     > RETURN                                                   null

End of function orderdata

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.71 ms | 1407 KiB | 18 Q