3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str1 = 'foobar'; $str2 = 'stack'; // your code $len = strlen($str1); $str = pack('V', $len) . $str1 . $str2; // unpacking $length_of_packed_string = strlen($str) - strlen($str1 . $str2); $unpacked = unpack('V', substr($str, 0, $length_of_packed_string)); print_r($unpacked);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dgWR9
function name:  (null)
number of ops:  30
compiled vars:  !0 = $str1, !1 = $str2, !2 = $len, !3 = $str, !4 = $length_of_packed_string, !5 = $unpacked
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'foobar'
    4     1        ASSIGN                                                   !1, 'stack'
    7     2        STRLEN                                           ~8      !0
          3        ASSIGN                                                   !2, ~8
    8     4        INIT_FCALL                                               'pack'
          5        SEND_VAL                                                 'V'
          6        SEND_VAR                                                 !2
          7        DO_ICALL                                         $10     
          8        CONCAT                                           ~11     $10, !0
          9        CONCAT                                           ~12     ~11, !1
         10        ASSIGN                                                   !3, ~12
   11    11        STRLEN                                           ~14     !3
         12        CONCAT                                           ~15     !0, !1
         13        STRLEN                                           ~16     ~15
         14        SUB                                              ~17     ~14, ~16
         15        ASSIGN                                                   !4, ~17
   12    16        INIT_FCALL                                               'unpack'
         17        SEND_VAL                                                 'V'
         18        INIT_FCALL                                               'substr'
         19        SEND_VAR                                                 !3
         20        SEND_VAL                                                 0
         21        SEND_VAR                                                 !4
         22        DO_ICALL                                         $19     
         23        SEND_VAR                                                 $19
         24        DO_ICALL                                         $20     
         25        ASSIGN                                                   !5, $20
   14    26        INIT_FCALL                                               'print_r'
         27        SEND_VAR                                                 !5
         28        DO_ICALL                                                 
         29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.49 ms | 1013 KiB | 17 Q