3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xpathStr = <<< STR //node[@cat="top" and node[@rel="--" and @cat="smain" and node[@rel="su" and @pt="vnw" and @word="Dit" and @lemma="dit" and number(@begin) < ../node[@rel="hd" and @pt="ww" and @lemma="zijn"]/number(@begin)] and node[@rel="hd" and @pt="ww" and @lemma="zijn" and number(@begin) < ../node[@rel="predc" and @cat="np"]/node[@rel="det" and @pt="lid" and @word="een" and @cs="no" and @lemma="een"]/number(@begin)] and node[@rel="predc" and @cat="np" and node[@rel="det" and @pt="lid" and @word="een" and @cs="no" and @lemma="een" and number(@begin) < ../node[@rel="hd" and @pt="n" and @cs="no" and @lemma="zin"]/number(@begin)] and node[@rel="hd" and @pt="n" and @cs="no" and @lemma="zin" and number(@begin) < ../../../node[@rel="--" and @pt="let"]/number(@begin)]]] and node[@rel="--" and @pt="let"]] STR; echo preg_replace_callback('~node\[(?:[^[]+(?=\]|node))~', function($match) { if (strpos($match[0], '@cs="no"') !== false) { return preg_replace( ['/@(lemma|word)/', '/\s*and\s*@cs="no"/'], ['lower-case(@$1)', ''], $match[0] ); } return $match[0]; }, $xpathStr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AK0BW
function name:  (null)
number of ops:  9
compiled vars:  !0 = $xpathStr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%2F%2Fnode%5B%40cat%3D%22top%22+and+node%5B%40rel%3D%22--%22+and+%40cat%3D%22smain%22+and+node%5B%40rel%3D%22su%22+and+%40pt%3D%22vnw%22+and+%40word%3D%22Dit%22+and+%40lemma%3D%22dit%22+and+number%28%40begin%29+%3C+..%2Fnode%5B%40rel%3D%22hd%22+and+%40pt%3D%22ww%22+and+%40lemma%3D%22zijn%22%5D%2Fnumber%28%40begin%29%5D+and+node%5B%40rel%3D%22hd%22+and+%40pt%3D%22ww%22+and+%40lemma%3D%22zijn%22+and+number%28%40begin%29+%3C+..%2Fnode%5B%40rel%3D%22predc%22+and+%40cat%3D%22np%22%5D%2Fnode%5B%40rel%3D%22det%22+and+%40pt%3D%22lid%22+and+%40word%3D%22een%22+and+%40cs%3D%22no%22+and+%40lemma%3D%22een%22%5D%2Fnumber%28%40begin%29%5D+and+node%5B%40rel%3D%22predc%22+and+%40cat%3D%22np%22+and+node%5B%40rel%3D%22det%22+and+%40pt%3D%22lid%22+and+%40word%3D%22een%22+and+%40cs%3D%22no%22+and+%40lemma%3D%22een%22+and+number%28%40begin%29+%3C+..%2Fnode%5B%40rel%3D%22hd%22+and+%40pt%3D%22n%22+and+%40cs%3D%22no%22+and+%40lemma%3D%22zin%22%5D%2Fnumber%28%40begin%29%5D+and+node%5B%40rel%3D%22hd%22+and+%40pt%3D%22n%22+and+%40cs%3D%22no%22+and+%40lemma%3D%22zin%22+and+number%28%40begin%29+%3C+..%2F..%2F..%2Fnode%5B%40rel%3D%22--%22+and+%40pt%3D%22let%22%5D%2Fnumber%28%40begin%29%5D%5D%5D+and+node%5B%40rel%3D%22--%22+and+%40pt%3D%22let%22%5D%5D'
    7     1        INIT_FCALL                                               'preg_replace_callback'
          2        SEND_VAL                                                 '%7Enode%5C%5B%28%3F%3A%5B%5E%5B%5D%2B%28%3F%3D%5C%5D%7Cnode%29%29%7E'
          3        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
   16     4        SEND_VAL                                                 ~2
          5        SEND_VAR                                                 !0
    7     6        DO_ICALL                                         $3      
   16     7        ECHO                                                     $3
          8      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 15
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AK0BW
function name:  {closure}
number of ops:  18
compiled vars:  !0 = $match
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        INIT_FCALL                                               'strpos'
          2        FETCH_DIM_R                                      ~1      !0, 0
          3        SEND_VAL                                                 ~1
          4        SEND_VAL                                                 '%40cs%3D%22no%22'
          5        DO_ICALL                                         $2      
          6        TYPE_CHECK                                  1018          $2
          7      > JMPZ                                                     ~3, ->15
    9     8    >   INIT_FCALL                                               'preg_replace'
   10     9        SEND_VAL                                                 <array>
   11    10        SEND_VAL                                                 <array>
   12    11        FETCH_DIM_R                                      ~4      !0, 0
         12        SEND_VAL                                                 ~4
    9    13        DO_ICALL                                         $5      
   12    14      > RETURN                                                   $5
   15    15    >   FETCH_DIM_R                                      ~6      !0, 0
         16      > RETURN                                                   ~6
   16    17*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.55 ms | 1009 KiB | 16 Q