3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gray_to_binary($value) { $dec = $value; for ($i = 1; $i < strlen($value); $i++) { $dec[$i] = (int)$dec[$i-1] ^ (int)$value[$i]; } return $dec; } echo bindec(gray_to_binary(decbin(115)));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/c1k1H
function name:  (null)
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'bindec'
          1        INIT_FCALL                                               'gray_to_binary'
          2        INIT_FCALL                                               'decbin'
          3        SEND_VAL                                                 115
          4        DO_ICALL                                         $0      
          5        SEND_VAR                                                 $0
          6        DO_FCALL                                      0  $1      
          7        SEND_VAR                                                 $1
          8        DO_ICALL                                         $2      
          9        ECHO                                                     $2
         10      > RETURN                                                   1

Function gray_to_binary:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 4
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 4
Branch analysis from position: 16
Branch analysis from position: 4
filename:       /in/c1k1H
function name:  gray_to_binary
number of ops:  18
compiled vars:  !0 = $value, !1 = $dec, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, !0
    5     2        ASSIGN                                                   !2, 1
          3      > JMP                                                      ->13
    6     4    >   SUB                                              ~6      !2, 1
          5        FETCH_DIM_R                                      ~7      !1, ~6
          6        CAST                                          4  ~8      ~7
          7        FETCH_DIM_R                                      ~9      !0, !2
          8        CAST                                          4  ~10     ~9
          9        BW_XOR                                           ~11     ~8, ~10
         10        ASSIGN_DIM                                               !1, !2
         11        OP_DATA                                                  ~11
    5    12        PRE_INC                                                  !2
         13    >   STRLEN                                           ~13     !0
         14        IS_SMALLER                                               !2, ~13
         15      > JMPNZ                                                    ~14, ->4
    8    16    > > RETURN                                                   !1
    9    17*     > RETURN                                                   null

End of function gray_to_binary

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.1 ms | 1431 KiB | 16 Q