3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string='bla bla xxx bla *xxx bla bla **xxx bla bla ***xxx bla bla ****xxx'; $search='xxx'; $char='*'; preg_replace_callback( '/(' . preg_quote($char) . '*)' . $search . '/', function($matches) { print strlen($matches[1]); if(strlen($matches[1]) % 2 !== 0) { return $matches[1] . '*'; } }, $string ); print $string;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d4Rcp
function name:  (null)
number of ops:  18
compiled vars:  !0 = $string, !1 = $search, !2 = $char
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'bla+bla+xxx+bla+%2Axxx+bla+bla+%2A%2Axxx+bla+bla+%2A%2A%2Axxx+bla+bla+%2A%2A%2A%2Axxx'
    4     1        ASSIGN                                                   !1, 'xxx'
    5     2        ASSIGN                                                   !2, '%2A'
    7     3        INIT_FCALL                                               'preg_replace_callback'
    8     4        INIT_FCALL                                               'preg_quote'
          5        SEND_VAR                                                 !2
          6        DO_ICALL                                         $6      
          7        CONCAT                                           ~7      '%2F%28', $6
          8        CONCAT                                           ~8      ~7, '%2A%29'
          9        CONCAT                                           ~9      ~8, !1
         10        CONCAT                                           ~10     ~9, '%2F'
         11        SEND_VAL                                                 ~10
    9    12        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fd4Rcp%3A9%240'
   15    13        SEND_VAL                                                 ~11
   16    14        SEND_VAR                                                 !0
         15        DO_ICALL                                                 
   19    16        ECHO                                                     !0
         17      > RETURN                                                   1

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

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.43 ms | 1396 KiB | 17 Q