3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(0); function f($s){ for($i=0,$n=count($s)-1;$j++<=$n;) if($k=$s[$j]){ $l=$k>0?n:i; ($x=$s[$$l])|($s[$$l]=$k)|($s[$j]=$x); $k>0?$n--|$j--:$i++; } echo print_r($s); } echo "-------------\n"; f( [5, 3, 0, -6, 2, 0, 5] ); echo "\n"; echo "-------------\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ivRX5
function name:  (null)
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 0
          2        DO_ICALL                                                 
   15     3        ECHO                                                     '-------------%0A'
   16     4        INIT_FCALL                                               'f'
          5        SEND_VAL                                                 <array>
          6        DO_FCALL                                      0          
          7        ECHO                                                     '%0A'
   17     8        ECHO                                                     '-------------%0A'
          9      > RETURN                                                   1

Function f:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 6
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 38
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 14
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 35
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 6
Branch analysis from position: 41
Branch analysis from position: 6
Branch analysis from position: 35
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 6
Branch analysis from position: 41
Branch analysis from position: 6
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 35
Branch analysis from position: 30
Branch analysis from position: 35
Branch analysis from position: 38
filename:       /in/ivRX5
function name:  f
number of ops:  46
compiled vars:  !0 = $s, !1 = $i, !2 = $n, !3 = $k, !4 = $j, !5 = $l, !6 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, 0
          2        COUNT                                            ~8      !0
          3        SUB                                              ~9      ~8, 1
          4        ASSIGN                                                   !2, ~9
          5      > JMP                                                      ->38
    6     6    >   FETCH_DIM_R                                      ~11     !0, !4
          7        ASSIGN                                           ~12     !3, ~11
          8      > JMPZ                                                     ~12, ->38
    7     9    >   IS_SMALLER                                               0, !3
         10      > JMPZ                                                     ~13, ->14
         11    >   FETCH_CONSTANT                                   ~14     'n'
         12        QM_ASSIGN                                        ~15     ~14
         13      > JMP                                                      ->16
         14    >   FETCH_CONSTANT                                   ~16     'i'
         15        QM_ASSIGN                                        ~15     ~16
         16    >   ASSIGN                                                   !5, ~15
    8    17        FETCH_R                      local               ~18     !5
         18        FETCH_DIM_R                                      ~19     !0, ~18
         19        ASSIGN                                           ~20     !6, ~19
         20        FETCH_R                      local               ~21     !5
         21        ASSIGN_DIM                                       ~22     !0, ~21
         22        OP_DATA                                                  !3
         23        BW_OR                                            ~23     ~20, ~22
         24        ASSIGN_DIM                                       ~24     !0, !4
         25        OP_DATA                                                  !6
         26        BW_OR                                            ~25     ~23, ~24
         27        FREE                                                     ~25
    9    28        IS_SMALLER                                               0, !3
         29      > JMPZ                                                     ~26, ->35
         30    >   POST_DEC                                         ~27     !2
         31        POST_DEC                                         ~28     !4
         32        BW_OR                                            ~29     ~27, ~28
         33        QM_ASSIGN                                        ~30     ~29
         34      > JMP                                                      ->37
         35    >   POST_INC                                         ~31     !1
         36        QM_ASSIGN                                        ~30     ~31
         37    >   FREE                                                     ~30
    5    38    >   POST_INC                                         ~32     !4
         39        IS_SMALLER_OR_EQUAL                                      ~32, !2
         40      > JMPNZ                                                    ~33, ->6
   11    41    >   INIT_FCALL                                               'print_r'
         42        SEND_VAR                                                 !0
         43        DO_ICALL                                         $34     
         44        ECHO                                                     $34
   13    45      > RETURN                                                   null

End of function f

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.91 ms | 1403 KiB | 18 Q