3v4l.org

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

Function %00%7Bclosure%7D%2Fin%2FNL9Xa%3A4%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NL9Xa
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%2FNL9Xa%3A4%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.96 ms | 1400 KiB | 27 Q