3v4l.org

run code in 300+ PHP versions simultaneously
<?php $torrent = 'd8:announce37:http://blender.waag.org:6969/announce13:creation datei1212070099e4:infod6:lengthi196898674e4:name30:big_buck_bunny_720p_stereo.ogg12:piece lengthi262144e6:pieces15040:DñÀsÑ45/'; $regex = "/(lengthi[0-9]+e)/i"; $sizes = array(); preg_replace_callback($regex, function($matches) use(&$sizes) { $sizes[] = substr($matches[2], 0, $matches[1]); }, $torrent); var_dump($sizes); // I want to get "262144", you can see this just before "pieces", top right
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/D9MQd
function name:  (null)
number of ops:  14
compiled vars:  !0 = $torrent, !1 = $regex, !2 = $sizes
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'd8%3Aannounce37%3Ahttp%3A%2F%2Fblender.waag.org%3A6969%2Fannounce13%3Acreation+datei1212070099e4%3Ainfod6%3Alengthi196898674e4%3Aname30%3Abig_buck_bunny_720p_stereo.ogg12%3Apiece+lengthi262144e6%3Apieces15040%3AD%C3%B1%C3%80s%C3%9145%2F'
    5     1        ASSIGN                                                   !1, '%2F%28lengthi%5B0-9%5D%2Be%29%2Fi'
    7     2        ASSIGN                                                   !2, <array>
    9     3        INIT_FCALL                                               'preg_replace_callback'
          4        SEND_VAR                                                 !1
          5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FD9MQd%3A9%240'
          6        BIND_LEXICAL                                             ~6, !2
   13     7        SEND_VAL                                                 ~6
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                                 
   15    10        INIT_FCALL                                               'var_dump'
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FD9MQd%3A9%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/D9MQd
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $matches, !1 = $sizes
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   12     2        INIT_FCALL                                               'substr'
          3        FETCH_DIM_R                                      ~3      !0, 2
          4        SEND_VAL                                                 ~3
          5        SEND_VAL                                                 0
          6        FETCH_DIM_R                                      ~4      !0, 1
          7        SEND_VAL                                                 ~4
          8        DO_ICALL                                         $5      
          9        ASSIGN_DIM                                               !1
         10        OP_DATA                                                  $5
   13    11      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FD9MQd%3A9%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.91 ms | 1396 KiB | 19 Q