3v4l.org

run code in 300+ PHP versions simultaneously
<?php function array_swap(&$input, $num) { $tmp = $input[0]; $input[0] = $input[$num]; $input[$num] = $tmp; } $input = [4, 5, 8, 9, 1, 7, 2]; function xsort($oldArray) { $newArray = array(); foreach($oldArray as $arr){ $newArray[] = $arr; } return $newArray; } var_dump(xsort($input));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EuiaC
function name:  (null)
number of ops:  8
compiled vars:  !0 = $input
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN                                                   !0, <array>
   21     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'xsort'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function array_swap:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EuiaC
function name:  array_swap
number of ops:  10
compiled vars:  !0 = $input, !1 = $num, !2 = $tmp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        FETCH_DIM_R                                      ~3      !0, 0
          3        ASSIGN                                                   !2, ~3
    6     4        FETCH_DIM_R                                      ~6      !0, !1
          5        ASSIGN_DIM                                               !0, 0
          6        OP_DATA                                                  ~6
    7     7        ASSIGN_DIM                                               !0, !1
          8        OP_DATA                                                  !2
    8     9      > RETURN                                                   null

End of function array_swap

Function xsort:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/EuiaC
function name:  xsort
number of ops:  10
compiled vars:  !0 = $oldArray, !1 = $newArray, !2 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   14     1        ASSIGN                                                   !1, <array>
   15     2      > FE_RESET_R                                       $4      !0, ->7
          3    > > FE_FETCH_R                                               $4, !2, ->7
   16     4    >   ASSIGN_DIM                                               !1
          5        OP_DATA                                                  !2
   15     6      > JMP                                                      ->3
          7    >   FE_FREE                                                  $4
   18     8      > RETURN                                                   !1
   19     9*     > RETURN                                                   null

End of function xsort

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.71 ms | 1399 KiB | 16 Q