3v4l.org

run code in 500+ PHP versions simultaneously
<?php $ar = [ [ 'hashtag' => 'a7e87329b5eab8578f4f1098a152d6f4', 'title' => 'Flower', 'order' => 3, ], [ 'hashtag' => 'e7d31fc0602fb2ede144d18cdffd816b', 'title' => 'Ready', 'order' => 1, ], [ 'hashtag' => 'b24ce0cd392a5b0b8dedc66c25213594', 'title' => 'Free', 'order' => 2, ], ]; $tempArray = array(); $annotations = array(); while ($row = current($ar)) { $needle = $row['order']; arrayIndexes($needle, $tempArray); // create a parallel array with IDs only $annotations[$needle]['title'] = $row['title']; // whatever next($ar); } asort($tempArray); foreach ($tempArray as $arrayKey) { echo $annotations[$arrayKey]['title'] . \PHP_EOL;; } function arrayIndexes ($needle, &$tempArray = array()) { $tempArray[] = $needle; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 4
Branch analysis from position: 22
2 jumps found. (Code = 77) Position 1 = 26, Position 2 = 32
Branch analysis from position: 26
2 jumps found. (Code = 78) Position 1 = 27, Position 2 = 32
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 4
Branch analysis from position: 22
Branch analysis from position: 4
filename:       /in/FEeFC
function name:  (null)
number of ops:  34
compiled vars:  !0 = $ar, !1 = $tempArray, !2 = $annotations, !3 = $needle, !4 = $row, !5 = $arrayKey
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   21     1        ASSIGN                                                       !1, <array>
   22     2        ASSIGN                                                       !2, <array>
   23     3      > JMP                                                          ->17
   24     4    >   FETCH_DIM_R                                          ~9      !4, 'order'
          5        ASSIGN                                                       !3, ~9
   25     6        INIT_FCALL_BY_NAME                                           'arrayIndexes'
          7        SEND_VAR_EX                                                  !3
          8        SEND_VAR_EX                                                  !1
          9        DO_FCALL                                          0          
   26    10        FETCH_DIM_R                                          ~14     !4, 'title'
         11        FETCH_DIM_W                                          $12     !2, !3
         12        ASSIGN_DIM                                                   $12, 'title'
         13        OP_DATA                                                      ~14
   27    14        INIT_FCALL                                                   'next'
         15        SEND_REF                                                     !0
         16        DO_ICALL                                                     
   23    17    >   INIT_FCALL                                                   'current'
         18        SEND_VAR                                                     !0
         19        DO_ICALL                                             $16     
         20        ASSIGN                                               ~17     !4, $16
         21      > JMPNZ                                                        ~17, ->4
   29    22    >   INIT_FCALL                                                   'asort'
         23        SEND_REF                                                     !1
         24        DO_ICALL                                                     
   30    25      > FE_RESET_R                                           $19     !1, ->32
         26    > > FE_FETCH_R                                                   $19, !5, ->32
   31    27    >   FETCH_DIM_R                                          ~20     !2, !5
         28        FETCH_DIM_R                                          ~21     ~20, 'title'
         29        CONCAT                                               ~22     ~21, '%0A'
         30        ECHO                                                         ~22
   30    31      > JMP                                                          ->26
         32    >   FE_FREE                                                      $19
   36    33      > RETURN                                                       1

Function arrayindexes:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FEeFC
function name:  arrayIndexes
number of ops:  5
compiled vars:  !0 = $needle, !1 = $tempArray
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   34     0  E >   RECV                                                 !0      
          1        RECV_INIT                                            !1      <array>
   35     2        ASSIGN_DIM                                                   !1
          3        OP_DATA                                                      !0
   36     4      > RETURN                                                       null

End of function arrayindexes

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
261.28 ms | 2033 KiB | 16 Q