3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [7, 3, 5, 4]; asort($arr); $temp = []; $count = 1; $key = key($arr); while (next($arr)) { $temp[$key] = key($arr); $key = key($arr); $count++; } $temp[$key] = -1; print_r($temp); $result = []; for ($i = 0; $i < $count; $i++) { $result[] = $temp[$i]; } print_r($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 11
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 33
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 33
Branch analysis from position: 39
Branch analysis from position: 33
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 11
Branch analysis from position: 25
Branch analysis from position: 11
filename:       /in/o2kWp
function name:  (null)
number of ops:  43
compiled vars:  !0 = $arr, !1 = $temp, !2 = $count, !3 = $key, !4 = $result, !5 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        INIT_FCALL                                               'asort'
          2        SEND_REF                                                 !0
          3        DO_ICALL                                                 
    5     4        ASSIGN                                                   !1, <array>
    6     5        ASSIGN                                                   !2, 1
    7     6        INIT_FCALL                                               'key'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $10     
          9        ASSIGN                                                   !3, $10
    8    10      > JMP                                                      ->21
    9    11    >   INIT_FCALL                                               'key'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                         $13     
         14        ASSIGN_DIM                                               !1, !3
         15        OP_DATA                                                  $13
   10    16        INIT_FCALL                                               'key'
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                         $14     
         19        ASSIGN                                                   !3, $14
   11    20        PRE_INC                                                  !2
    8    21    >   INIT_FCALL                                               'next'
         22        SEND_REF                                                 !0
         23        DO_ICALL                                         $17     
         24      > JMPNZ                                                    $17, ->11
   13    25    >   ASSIGN_DIM                                               !1, !3
         26        OP_DATA                                                  -1
   14    27        INIT_FCALL                                               'print_r'
         28        SEND_VAR                                                 !1
         29        DO_ICALL                                                 
   15    30        ASSIGN                                                   !4, <array>
   16    31        ASSIGN                                                   !5, 0
         32      > JMP                                                      ->37
   17    33    >   FETCH_DIM_R                                      ~23     !1, !5
         34        ASSIGN_DIM                                               !4
         35        OP_DATA                                                  ~23
   16    36        PRE_INC                                                  !5
         37    >   IS_SMALLER                                               !5, !2
         38      > JMPNZ                                                    ~25, ->33
   19    39    >   INIT_FCALL                                               'print_r'
         40        SEND_VAR                                                 !4
         41        DO_ICALL                                                 
         42      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.15 ms | 1006 KiB | 17 Q