3v4l.org

run code in 300+ PHP versions simultaneously
<?php function countLetters($matches) { return $matches[0] . '(' . strlen($matches[0]) . ')'; } $input = "Welcome to W3Schools.com!"; $pattern = '/[a-z0-9\.]+/i'; $limit = -1; $count = null; $flag = 0; $result = preg_replace_callback($pattern, 'countLetters', $input, $limit, $count, $flag); echo $result;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6cAT6
function name:  (null)
number of ops:  16
compiled vars:  !0 = $input, !1 = $pattern, !2 = $limit, !3 = $count, !4 = $flag, !5 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                   !0, 'Welcome+to+W3Schools.com%21'
    8     1        ASSIGN                                                   !1, '%2F%5Ba-z0-9%5C.%5D%2B%2Fi'
    9     2        ASSIGN                                                   !2, -1
   10     3        ASSIGN                                                   !3, null
   11     4        ASSIGN                                                   !4, 0
   12     5        INIT_FCALL                                               'preg_replace_callback'
          6        SEND_VAR                                                 !1
          7        SEND_VAL                                                 'countLetters'
          8        SEND_VAR                                                 !0
          9        SEND_VAR                                                 !2
         10        SEND_REF                                                 !3
         11        SEND_VAR                                                 !4
         12        DO_ICALL                                         $11     
         13        ASSIGN                                                   !5, $11
   13    14        ECHO                                                     !5
   14    15      > RETURN                                                   1

Function countletters:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6cAT6
function name:  countLetters
number of ops:  9
compiled vars:  !0 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        FETCH_DIM_R                                      ~1      !0, 0
          2        CONCAT                                           ~2      ~1, '%28'
          3        FETCH_DIM_R                                      ~3      !0, 0
          4        STRLEN                                           ~4      ~3
          5        CONCAT                                           ~5      ~2, ~4
          6        CONCAT                                           ~6      ~5, '%29'
          7      > RETURN                                                   ~6
    5     8*     > RETURN                                                   null

End of function countletters

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.48 ms | 1436 KiB | 14 Q