3v4l.org

run code in 300+ PHP versions simultaneously
<?php function encode_char($c) { $sum = ord($c); $first = rand(-100,100); $second = rand(-100,100); $third = $sum - ($first + $second); return [$first, $second, $third]; } function encode_string($st) { $encoded_string = []; foreach ($st as $c) { array_push($encoded_string, encode_char($c)); } return $encoded_string; } function str_rep($encoded_string) { $str_rep = []; foreach ($encoded_string as $encoded_c) { array_push($str_rep, join(",", $encoded_c)); } return join(";", $str_rep); } print(str_rep('ab')); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dWlIg
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   37     0  E >   INIT_FCALL                                               'str_rep'
          1        SEND_VAL                                                 'ab'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
   39     4      > RETURN                                                   1

Function encode_char:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dWlIg
function name:  encode_char
number of ops:  23
compiled vars:  !0 = $c, !1 = $sum, !2 = $first, !3 = $second, !4 = $third
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'ord'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $5      
          4        ASSIGN                                                   !1, $5
    6     5        INIT_FCALL                                               'rand'
          6        SEND_VAL                                                 -100
          7        SEND_VAL                                                 100
          8        DO_ICALL                                         $7      
          9        ASSIGN                                                   !2, $7
    7    10        INIT_FCALL                                               'rand'
         11        SEND_VAL                                                 -100
         12        SEND_VAL                                                 100
         13        DO_ICALL                                         $9      
         14        ASSIGN                                                   !3, $9
    8    15        ADD                                              ~11     !2, !3
         16        SUB                                              ~12     !1, ~11
         17        ASSIGN                                                   !4, ~12
   10    18        INIT_ARRAY                                       ~14     !2
         19        ADD_ARRAY_ELEMENT                                ~14     !3
         20        ADD_ARRAY_ELEMENT                                ~14     !4
         21      > RETURN                                                   ~14
   11    22*     > RETURN                                                   null

End of function encode_char

Function encode_string:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 12
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 12
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/dWlIg
function name:  encode_string
number of ops:  15
compiled vars:  !0 = $st, !1 = $encoded_string, !2 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   15     1        ASSIGN                                                   !1, <array>
   16     2      > FE_RESET_R                                       $4      !0, ->12
          3    > > FE_FETCH_R                                               $4, !2, ->12
   17     4    >   INIT_FCALL                                               'array_push'
          5        SEND_REF                                                 !1
          6        INIT_FCALL                                               'encode_char'
          7        SEND_VAR                                                 !2
          8        DO_FCALL                                      0  $5      
          9        SEND_VAR                                                 $5
         10        DO_ICALL                                                 
   16    11      > JMP                                                      ->3
         12    >   FE_FREE                                                  $4
   20    13      > RETURN                                                   !1
   21    14*     > RETURN                                                   null

End of function encode_string

Function str_rep:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 13
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/dWlIg
function name:  str_rep
number of ops:  20
compiled vars:  !0 = $encoded_string, !1 = $str_rep, !2 = $encoded_c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   RECV                                             !0      
   26     1        ASSIGN                                                   !1, <array>
   28     2      > FE_RESET_R                                       $4      !0, ->13
          3    > > FE_FETCH_R                                               $4, !2, ->13
   30     4    >   INIT_FCALL                                               'array_push'
          5        SEND_REF                                                 !1
          6        INIT_FCALL                                               'join'
          7        SEND_VAL                                                 '%2C'
          8        SEND_VAR                                                 !2
          9        DO_ICALL                                         $5      
         10        SEND_VAR                                                 $5
         11        DO_ICALL                                                 
   28    12      > JMP                                                      ->3
         13    >   FE_FREE                                                  $4
   33    14        INIT_FCALL                                               'join'
         15        SEND_VAL                                                 '%3B'
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                         $7      
         18      > RETURN                                                   $7
   34    19*     > RETURN                                                   null

End of function str_rep

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.99 ms | 1407 KiB | 23 Q