3v4l.org

run code in 500+ PHP versions simultaneously
<?php $string = 'jème lé ponés'; mb_ereg_search_init($string, '(?<=[ ^])\w+'); // Detect words while ($pos = mb_ereg_search_pos()) { $match = mb_ereg_search_getregs()[0]; $matchBasedOnPos = substr($string, $pos[0], $pos[1]); if ($matchBasedOnPos !== $match) { throw new \LogicException("Match based on position '{$matchBasedOnPos}' does not correspond to actual match '{$match}'"); } var_dump(mb_strlen($matchBasedOnPos)); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 6
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 26
Branch analysis from position: 17
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 6
Branch analysis from position: 36
Branch analysis from position: 6
filename:       /in/oK639
function name:  (null)
number of ops:  37
compiled vars:  !0 = $string, !1 = $match, !2 = $matchBasedOnPos, !3 = $pos
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 'j%C3%A8me+l%C3%A9+pon%C3%A9s'
    4     1        INIT_FCALL                                                   'mb_ereg_search_init'
          2        SEND_VAR                                                     !0
          3        SEND_VAL                                                     '%28%3F%3C%3D%5B+%5E%5D%29%5Cw%2B'
          4        DO_ICALL                                                     
    5     5      > JMP                                                          ->32
    6     6    >   INIT_FCALL                                                   'mb_ereg_search_getregs'
          7        DO_ICALL                                             $6      
          8        FETCH_DIM_R                                          ~7      $6, 0
          9        ASSIGN                                                       !1, ~7
    7    10        FETCH_DIM_R                                          ~9      !3, 0
         11        FETCH_DIM_R                                          ~10     !3, 1
         12        FRAMELESS_ICALL_3                substr              ~11     !0, ~9
         13        OP_DATA                                                      ~10
         14        ASSIGN                                                       !2, ~11
    8    15        IS_NOT_IDENTICAL                                             !2, !1
         16      > JMPZ                                                         ~13, ->26
    9    17    >   NEW                                                  $14     'LogicException'
         18        ROPE_INIT                                         5  ~16     'Match+based+on+position+%27'
         19        ROPE_ADD                                          1  ~16     ~16, !2
         20        ROPE_ADD                                          2  ~16     ~16, '%27+does+not+correspond+to+actual+match+%27'
         21        ROPE_ADD                                          3  ~16     ~16, !1
         22        ROPE_END                                          4  ~15     ~16, '%27'
         23        SEND_VAL_EX                                                  ~15
         24        DO_FCALL                                          0          
         25      > THROW                                             0          $14
   11    26    >   INIT_FCALL                                                   'var_dump'
         27        INIT_FCALL                                                   'mb_strlen'
         28        SEND_VAR                                                     !2
         29        DO_ICALL                                             $20     
         30        SEND_VAR                                                     $20
         31        DO_ICALL                                                     
    5    32    >   INIT_FCALL                                                   'mb_ereg_search_pos'
         33        DO_ICALL                                             $22     
         34        ASSIGN                                               ~23     !3, $22
         35      > JMPNZ                                                        ~23, ->6
   12    36    > > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
179.68 ms | 1998 KiB | 19 Q