3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = "<div> <img src='/logo.png'>[:ru]Привет мир[:en]Hello World[:] </div>"; $lang = 'ru'; echo preg_replace_callback('#\[:.*\[:\]#isuU', function ($find) use ($lang) { //print_r($matches); if (preg_match('#\[:'+$lang + '\](.*)\[:#isuU', $find[0], $matches)) { return $matches[1]; } }, $html);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LMJWK
function name:  (null)
number of ops:  11
compiled vars:  !0 = $html, !1 = $lang
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Cdiv%3E%0A%3Cimg+src%3D%27%2Flogo.png%27%3E%5B%3Aru%5D%D0%9F%D1%80%D0%B8%D0%B2%D0%B5%D1%82+%D0%BC%D0%B8%D1%80%5B%3Aen%5DHello+World%5B%3A%5D%0A%3C%2Fdiv%3E'
    7     1        ASSIGN                                                   !1, 'ru'
    9     2        INIT_FCALL                                               'preg_replace_callback'
          3        SEND_VAL                                                 '%23%5C%5B%3A.%2A%5C%5B%3A%5C%5D%23isuU'
          4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FLMJWK%3A9%240'
          5        BIND_LEXICAL                                             ~4, !1
   15     6        SEND_VAL                                                 ~4
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $5      
          9        ECHO                                                     $5
         10      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FLMJWK%3A9%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LMJWK
function name:  {closure}
number of ops:  14
compiled vars:  !0 = $find, !1 = $lang, !2 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   12     2        INIT_FCALL                                               'preg_match'
          3        ADD                                              ~3      '%23%5C%5B%3A', !1
          4        ADD                                              ~4      ~3, '%5C%5D%28.%2A%29%5C%5B%3A%23isuU'
          5        SEND_VAL                                                 ~4
          6        FETCH_DIM_R                                      ~5      !0, 0
          7        SEND_VAL                                                 ~5
          8        SEND_REF                                                 !2
          9        DO_ICALL                                         $6      
         10      > JMPZ                                                     $6, ->13
   13    11    >   FETCH_DIM_R                                      ~7      !2, 1
         12      > RETURN                                                   ~7
   15    13    > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FLMJWK%3A9%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.53 ms | 1396 KiB | 17 Q