3v4l.org

run code in 500+ 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 = 5, Position 2 = 9
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AK0BW
function name:  {closure:/in/AK0BW:7}
number of ops:  12
compiled vars:  !0 = $match
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   RECV                                                 !0      
    8     1        FETCH_DIM_R                                          ~1      !0, 0
          2        FRAMELESS_ICALL_2                strpos              ~2      ~1, '%40cs%3D%22no%22'
          3        TYPE_CHECK                                      1018          ~2
          4      > JMPZ                                                         ~3, ->9
   12     5    >   FETCH_DIM_R                                          ~4      !0, 0
    9     6        FRAMELESS_ICALL_3                preg_replace        ~5      <array>, <array>
   12     7        OP_DATA                                                      ~4
          8      > RETURN                                                       ~5
   15     9    >   FETCH_DIM_R                                          ~6      !0, 0
         10      > RETURN                                                       ~6
   16    11*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
161.9 ms | 2839 KiB | 14 Q