3v4l.org

run code in 300+ PHP versions simultaneously
<?php ////////////////////////////////////////////////////////////////// // // This is not a difficult test, but it will test your ability to // read and write code as it might exist within our application. // // This should take less than 30 minutes. // // Good luck! // ////////////////////////////////////////////////////////////////// // Part One: Reading ////////////////////////////// // Your challenge here is to figure out what this code does. // Please change the variable names to something more appropriate, // and also comment it to the best of your ability. $s = 'typewriter'; $t = array( ); $a = str_split( $s ); $o = array( ); $o['a'] = array( 'q', 'w', 'z', 'x' ); $o['b'] = array( 'v', 'f', 'g', 'h', 'n' ); $o['c'] = array( 'x', 's', 'd', 'f', 'v' ); $o['d'] = array( 'x', 's', 'w', 'e', 'r', 'f', 'v', 'c' ); $o['e'] = array( 'w', 's', 'd', 'f', 'r' ); $o['f'] = array( 'c', 'd', 'e', 'r', 't', 'g', 'b', 'v' ); $o['g'] = array( 'r', 'f', 'v', 't', 'b', 'y', 'h', 'n' ); $o['h'] = array( 'b', 'g', 't', 'y', 'u', 'j', 'm', 'n' ); $o['i'] = array( 'u', 'j', 'k', 'l', 'o' ); $o['j'] = array( 'n', 'h', 'y', 'u', 'i', 'k', 'm' ); $o['k'] = array( 'u', 'j', 'm', 'l', 'o' ); $o['l'] = array( 'p', 'o', 'i', 'k', 'm' ); $o['m'] = array( 'n', 'h', 'j', 'k', 'l' ); $o['n'] = array( 'b', 'g', 'h', 'j', 'm' ); $o['o'] = array( 'i', 'k', 'l', 'p' ); $o['p'] = array( 'o', 'l' ); $o['r'] = array( 'e', 'd', 'f', 'g', 't' ); $o['s'] = array( 'q', 'w', 'e', 'z', 'x', 'c' ); $o['t'] = array( 'r', 'f', 'g', 'h', 'y' ); $o['u'] = array( 'y', 'h', 'j', 'k', 'i' ); $o['v'] = array( '', 'c', 'd', 'f', 'g', 'b' ); $o['w'] = array( 'q', 'a', 's', 'd', 'e' ); $o['x'] = array( 'z', 'a', 's', 'd', 'c' ); $o['y'] = array( 't', 'g', 'h', 'j', 'u' ); $o['z'] = array( 'x', 's', 'a' ); $o['1'] = array( 'q', 'w' ); $o['2'] = array( 'q', 'w', 'e' ); $o['3'] = array( 'w', 'e', 'r' ); $o['4'] = array( 'e', 'r', 't' ); $o['5'] = array( 'r', 't', 'y' ); $o['6'] = array( 't', 'y', 'u' ); $o['7'] = array( 'y', 'u', 'i' ); $o['8'] = array( 'u', 'i', 'o' ); $o['9'] = array( 'i', 'o', 'p' ); $o['0'] = array( 'o', 'p' ); foreach( $a as $key => $value ) { $u = $a; foreach( $o[$value] as $p ) { $u[$key] = $p; $t[] = join( "", $u ); } } print_r( $t ); ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 78, Position 2 = 95
Branch analysis from position: 78
2 jumps found. (Code = 78) Position 1 = 79, Position 2 = 95
Branch analysis from position: 79
2 jumps found. (Code = 77) Position 1 = 83, Position 2 = 93
Branch analysis from position: 83
2 jumps found. (Code = 78) Position 1 = 84, Position 2 = 93
Branch analysis from position: 84
1 jumps found. (Code = 42) Position 1 = 83
Branch analysis from position: 83
Branch analysis from position: 93
1 jumps found. (Code = 42) Position 1 = 78
Branch analysis from position: 78
Branch analysis from position: 93
Branch analysis from position: 95
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 95
filename:       /in/1X0WV
function name:  (null)
number of ops:  100
compiled vars:  !0 = $s, !1 = $t, !2 = $a, !3 = $o, !4 = $value, !5 = $key, !6 = $u, !7 = $p
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   ASSIGN                                                   !0, 'typewriter'
   22     1        ASSIGN                                                   !1, <array>
   23     2        INIT_FCALL                                               'str_split'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $10     
          5        ASSIGN                                                   !2, $10
   25     6        ASSIGN                                                   !3, <array>
   26     7        ASSIGN_DIM                                               !3, 'a'
          8        OP_DATA                                                  <array>
   27     9        ASSIGN_DIM                                               !3, 'b'
         10        OP_DATA                                                  <array>
   28    11        ASSIGN_DIM                                               !3, 'c'
         12        OP_DATA                                                  <array>
   29    13        ASSIGN_DIM                                               !3, 'd'
         14        OP_DATA                                                  <array>
   30    15        ASSIGN_DIM                                               !3, 'e'
         16        OP_DATA                                                  <array>
   31    17        ASSIGN_DIM                                               !3, 'f'
         18        OP_DATA                                                  <array>
   32    19        ASSIGN_DIM                                               !3, 'g'
         20        OP_DATA                                                  <array>
   33    21        ASSIGN_DIM                                               !3, 'h'
         22        OP_DATA                                                  <array>
   34    23        ASSIGN_DIM                                               !3, 'i'
         24        OP_DATA                                                  <array>
   35    25        ASSIGN_DIM                                               !3, 'j'
         26        OP_DATA                                                  <array>
   36    27        ASSIGN_DIM                                               !3, 'k'
         28        OP_DATA                                                  <array>
   37    29        ASSIGN_DIM                                               !3, 'l'
         30        OP_DATA                                                  <array>
   38    31        ASSIGN_DIM                                               !3, 'm'
         32        OP_DATA                                                  <array>
   39    33        ASSIGN_DIM                                               !3, 'n'
         34        OP_DATA                                                  <array>
   40    35        ASSIGN_DIM                                               !3, 'o'
         36        OP_DATA                                                  <array>
   41    37        ASSIGN_DIM                                               !3, 'p'
         38        OP_DATA                                                  <array>
   42    39        ASSIGN_DIM                                               !3, 'r'
         40        OP_DATA                                                  <array>
   43    41        ASSIGN_DIM                                               !3, 's'
         42        OP_DATA                                                  <array>
   44    43        ASSIGN_DIM                                               !3, 't'
         44        OP_DATA                                                  <array>
   45    45        ASSIGN_DIM                                               !3, 'u'
         46        OP_DATA                                                  <array>
   46    47        ASSIGN_DIM                                               !3, 'v'
         48        OP_DATA                                                  <array>
   47    49        ASSIGN_DIM                                               !3, 'w'
         50        OP_DATA                                                  <array>
   48    51        ASSIGN_DIM                                               !3, 'x'
         52        OP_DATA                                                  <array>
   49    53        ASSIGN_DIM                                               !3, 'y'
         54        OP_DATA                                                  <array>
   50    55        ASSIGN_DIM                                               !3, 'z'
         56        OP_DATA                                                  <array>
   51    57        ASSIGN_DIM                                               !3, 1
         58        OP_DATA                                                  <array>
   52    59        ASSIGN_DIM                                               !3, 2
         60        OP_DATA                                                  <array>
   53    61        ASSIGN_DIM                                               !3, 3
         62        OP_DATA                                                  <array>
   54    63        ASSIGN_DIM                                               !3, 4
         64        OP_DATA                                                  <array>
   55    65        ASSIGN_DIM                                               !3, 5
         66        OP_DATA                                                  <array>
   56    67        ASSIGN_DIM                                               !3, 6
         68        OP_DATA                                                  <array>
   57    69        ASSIGN_DIM                                               !3, 7
         70        OP_DATA                                                  <array>
   58    71        ASSIGN_DIM                                               !3, 8
         72        OP_DATA                                                  <array>
   59    73        ASSIGN_DIM                                               !3, 9
         74        OP_DATA                                                  <array>
   60    75        ASSIGN_DIM                                               !3, 0
         76        OP_DATA                                                  <array>
   62    77      > FE_RESET_R                                       $48     !2, ->95
         78    > > FE_FETCH_R                                       ~49     $48, !4, ->95
         79    >   ASSIGN                                                   !5, ~49
   64    80        ASSIGN                                                   !6, !2
   67    81        FETCH_DIM_R                                      ~52     !3, !4
         82      > FE_RESET_R                                       $53     ~52, ->93
         83    > > FE_FETCH_R                                               $53, !7, ->93
   69    84    >   ASSIGN_DIM                                               !6, !5
         85        OP_DATA                                                  !7
   70    86        INIT_FCALL                                               'join'
         87        SEND_VAL                                                 ''
         88        SEND_VAR                                                 !6
         89        DO_ICALL                                         $56     
         90        ASSIGN_DIM                                               !1
         91        OP_DATA                                                  $56
   67    92      > JMP                                                      ->83
         93    >   FE_FREE                                                  $53
   62    94      > JMP                                                      ->78
         95    >   FE_FREE                                                  $48
   74    96        INIT_FCALL                                               'print_r'
         97        SEND_VAR                                                 !1
         98        DO_ICALL                                                 
   79    99      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.87 ms | 1404 KiB | 19 Q