3v4l.org

run code in 300+ 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 = 35
Branch analysis from position: 35
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 6
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 29
Branch analysis from position: 20
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 6
Branch analysis from position: 39
Branch analysis from position: 6
filename:       /in/oK639
function name:  (null)
number of ops:  40
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                                                      ->35
   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        INIT_FCALL                                               'substr'
        11        SEND_VAR                                                 !0
        12        FETCH_DIM_R                                      ~9      !3, 0
        13        SEND_VAL                                                 ~9
        14        FETCH_DIM_R                                      ~10     !3, 1
        15        SEND_VAL                                                 ~10
        16        DO_ICALL                                         $11     
        17        ASSIGN                                                   !2, $11
   8    18        IS_EQUAL                                         ~13     !2, !1
        19      > JMPZ                                                     ~13, ->29
   9    20    >   NEW                                              $14     :43
        21        ROPE_INIT                                     5  ~16     'Match+based+on+position+%27'
        22        ROPE_ADD                                      1  ~16     ~16, !2
        23        ROPE_ADD                                      2  ~16     ~16, '%27+does+not+correspond+to+actual+match+%27'
        24        ROPE_ADD                                      3  ~16     ~16, !1
        25        ROPE_END                                      4  ~15     ~16, '%27'
        26        SEND_VAL_EX                                              ~15
        27        DO_FCALL                                      0          
        28      > THROW                                         0          $14
  11    29    >   INIT_FCALL                                               'var_dump'
        30        INIT_FCALL                                               'mb_strlen'
        31        SEND_VAR                                                 !2
        32        DO_ICALL                                         $20     
        33        SEND_VAR                                                 $20
        34        DO_ICALL                                                 
   5    35    >   INIT_FCALL                                               'mb_ereg_search_pos'
        36        DO_ICALL                                         $22     
        37        ASSIGN                                           $23     !3, $22
        38      > JMPNZ                                                    $23, ->6
  12    39    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
62.23 ms | 416 KiB | 7 Q