3v4l.org

run code in 300+ PHP versions simultaneously
<?php function showRawCharacters($result) { $resultInHex = unpack('H*', $result); $resultInHex = $resultInHex[1]; $resultSeparated = implode(', ', str_split($resultInHex, 2)); echo $resultSeparated; } $tests = array('a', 'Z'); foreach ($tests as $packChar) { $packString = $packChar.'*'.$packChar.'*'.$packChar.'*'; echo "Packing with: ".$packString."\n"; $data = pack($packString, "foo", "bar", "baz"); echo "packed is: \n"; showRawCharacters($data); $y = unpack('Z3omg/Z3lol/Z3bbq' , $data ); echo "\nPHP 5.5 Z\n"; var_dump($y); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 33
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 33
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
filename:       /in/dQKJ8
function name:  (null)
number of ops:  35
compiled vars:  !0 = $tests, !1 = $packChar, !2 = $packString, !3 = $data, !4 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN                                                   !0, <array>
   12     1      > FE_RESET_R                                       $6      !0, ->33
          2    > > FE_FETCH_R                                               $6, !1, ->33
   13     3    >   CONCAT                                           ~7      !1, '%2A'
          4        CONCAT                                           ~8      ~7, !1
          5        CONCAT                                           ~9      ~8, '%2A'
          6        CONCAT                                           ~10     ~9, !1
          7        CONCAT                                           ~11     ~10, '%2A'
          8        ASSIGN                                                   !2, ~11
   15     9        CONCAT                                           ~13     'Packing+with%3A+', !2
         10        CONCAT                                           ~14     ~13, '%0A'
         11        ECHO                                                     ~14
   17    12        INIT_FCALL                                               'pack'
         13        SEND_VAR                                                 !2
         14        SEND_VAL                                                 'foo'
         15        SEND_VAL                                                 'bar'
         16        SEND_VAL                                                 'baz'
         17        DO_ICALL                                         $15     
         18        ASSIGN                                                   !3, $15
   19    19        ECHO                                                     'packed+is%3A+%0A'
   20    20        INIT_FCALL                                               'showrawcharacters'
         21        SEND_VAR                                                 !3
         22        DO_FCALL                                      0          
   22    23        INIT_FCALL                                               'unpack'
         24        SEND_VAL                                                 'Z3omg%2FZ3lol%2FZ3bbq'
         25        SEND_VAR                                                 !3
         26        DO_ICALL                                         $18     
         27        ASSIGN                                                   !4, $18
   23    28        ECHO                                                     '%0APHP+5.5+Z%0A'
   24    29        INIT_FCALL                                               'var_dump'
         30        SEND_VAR                                                 !4
         31        DO_ICALL                                                 
   12    32      > JMP                                                      ->2
         33    >   FE_FREE                                                  $6
   25    34      > RETURN                                                   1

Function showrawcharacters:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dQKJ8
function name:  showRawCharacters
number of ops:  19
compiled vars:  !0 = $result, !1 = $resultInHex, !2 = $resultSeparated
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'unpack'
          2        SEND_VAL                                                 'H%2A'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !1, $3
    5     6        FETCH_DIM_R                                      ~5      !1, 1
          7        ASSIGN                                                   !1, ~5
    6     8        INIT_FCALL                                               'implode'
          9        SEND_VAL                                                 '%2C+'
         10        INIT_FCALL                                               'str_split'
         11        SEND_VAR                                                 !1
         12        SEND_VAL                                                 2
         13        DO_ICALL                                         $7      
         14        SEND_VAR                                                 $7
         15        DO_ICALL                                         $8      
         16        ASSIGN                                                   !2, $8
    7    17        ECHO                                                     !2
    8    18      > RETURN                                                   null

End of function showrawcharacters

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.18 ms | 1403 KiB | 24 Q