3v4l.org

run code in 300+ PHP versions simultaneously
<?php $hexColor = 'ff12'; $color = implode('', array_map(function($color){ return str_repeat($color, 2); }, str_split($hexColor))); echo $color; echo PHP_EOL; print_r( array( 'R' => hexdec($color[0] . $color[1]), 'G' => hexdec($color[2] . $color[3]), 'B' => hexdec($color[4] . $color[5]), ) ); $test = sscanf($color, '%02x%02x%02x', $RGB['R'], $RGB['G'], $RGB['B']); var_dump($test); print_r( $RGB ); echo PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gefQG
function name:  (null)
number of ops:  59
compiled vars:  !0 = $hexColor, !1 = $color, !2 = $test, !3 = $RGB
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'ff12'
    4     1        INIT_FCALL                                               'implode'
          2        SEND_VAL                                                 ''
          3        INIT_FCALL                                               'array_map'
          4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FgefQG%3A4%240'
          5        SEND_VAL                                                 ~5
          6        INIT_FCALL                                               'str_split'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $6      
          9        SEND_VAR                                                 $6
         10        DO_ICALL                                         $7      
         11        SEND_VAR                                                 $7
         12        DO_ICALL                                         $8      
         13        ASSIGN                                                   !1, $8
    6    14        ECHO                                                     !1
    7    15        ECHO                                                     '%0A'
    9    16        INIT_FCALL                                               'print_r'
   10    17        INIT_FCALL                                               'hexdec'
         18        FETCH_DIM_R                                      ~10     !1, 0
         19        FETCH_DIM_R                                      ~11     !1, 1
         20        CONCAT                                           ~12     ~10, ~11
         21        SEND_VAL                                                 ~12
         22        DO_ICALL                                         $13     
         23        INIT_ARRAY                                       ~14     $13, 'R'
   11    24        INIT_FCALL                                               'hexdec'
         25        FETCH_DIM_R                                      ~15     !1, 2
         26        FETCH_DIM_R                                      ~16     !1, 3
         27        CONCAT                                           ~17     ~15, ~16
         28        SEND_VAL                                                 ~17
         29        DO_ICALL                                         $18     
         30        ADD_ARRAY_ELEMENT                                ~14     $18, 'G'
   12    31        INIT_FCALL                                               'hexdec'
         32        FETCH_DIM_R                                      ~19     !1, 4
         33        FETCH_DIM_R                                      ~20     !1, 5
         34        CONCAT                                           ~21     ~19, ~20
         35        SEND_VAL                                                 ~21
         36        DO_ICALL                                         $22     
         37        ADD_ARRAY_ELEMENT                                ~14     $22, 'B'
         38        SEND_VAL                                                 ~14
         39        DO_ICALL                                                 
   15    40        INIT_FCALL                                               'sscanf'
         41        SEND_VAR                                                 !1
         42        SEND_VAL                                                 '%2502x%2502x%2502x'
         43        FETCH_DIM_W                                      $24     !3, 'R'
         44        SEND_REF                                                 $24
         45        FETCH_DIM_W                                      $25     !3, 'G'
         46        SEND_REF                                                 $25
         47        FETCH_DIM_W                                      $26     !3, 'B'
         48        SEND_REF                                                 $26
         49        DO_ICALL                                         $27     
         50        ASSIGN                                                   !2, $27
   16    51        INIT_FCALL                                               'var_dump'
         52        SEND_VAR                                                 !2
         53        DO_ICALL                                                 
   17    54        INIT_FCALL                                               'print_r'
         55        SEND_VAR                                                 !3
         56        DO_ICALL                                                 
   19    57        ECHO                                                     '%0A'
         58      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FgefQG%3A4%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gefQG
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $color
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'str_repeat'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 2
          4        DO_ICALL                                         $1      
          5      > RETURN                                                   $1
          6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FgefQG%3A4%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.3 ms | 1392 KiB | 29 Q