3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string_source = 'blabla[Sun][Sun]blabla[Moon][Moon][Moon]blabla[Sun][Sun][Sun][Sun]blabla[Venus]'; $string_source = preg_replace_callback('/(\[[^[]]+\])+/', function($matches) { return $matches[1].'['.(strlen($matches[0])/strlen($matches[1])).']'; }, $string_source); var_dump($string_source);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lTLj5
function name:  (null)
number of ops:  12
compiled vars:  !0 = $string_source
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'blabla%5BSun%5D%5BSun%5Dblabla%5BMoon%5D%5BMoon%5D%5BMoon%5Dblabla%5BSun%5D%5BSun%5D%5BSun%5D%5BSun%5Dblabla%5BVenus%5D'
    5     1        INIT_FCALL                                               'preg_replace_callback'
          2        SEND_VAL                                                 '%2F%28%5C%5B%5B%5E%5B%5D%5D%2B%5C%5D%29%2B%2F'
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FlTLj5%3A5%240'
    8     4        SEND_VAL                                                 ~2
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $3      
    5     7        ASSIGN                                                   !0, $3
   10     8        INIT_FCALL                                               'var_dump'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FlTLj5%3A5%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lTLj5
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    7     1        FETCH_DIM_R                                      ~1      !0, 1
          2        CONCAT                                           ~2      ~1, '%5B'
          3        FETCH_DIM_R                                      ~3      !0, 0
          4        STRLEN                                           ~4      ~3
          5        FETCH_DIM_R                                      ~5      !0, 1
          6        STRLEN                                           ~6      ~5
          7        DIV                                              ~7      ~4, ~6
          8        CONCAT                                           ~8      ~2, ~7
          9        CONCAT                                           ~9      ~8, '%5D'
         10      > RETURN                                                   ~9
    8    11*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FlTLj5%3A5%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.26 ms | 1395 KiB | 17 Q