3v4l.org

run code in 500+ PHP versions simultaneously
<?php $artlit = '<ul> <li>Aliev BF.</li> <li>Zyzov IM, Gazhva SI.</li> <li>Mamedzade RE.</li> <li>Mitronin AV, Platonova ASh</li> <li>Nasirova HB.</li> </ul>'; $doi = '2129-8124-2022-3-81-7-12'; $i = 0; $str = ''; $artlit = str_replace(array('<ul>', '</ul>', '</li>'), array('<citation_list>', '</citation_list>', "</unstructured_citation>\n</citation>"), $artlit); $artlit = preg_replace_callback('/<li>/', function ($m) use ($doi, &$i) { return '<citation key="key-'. $doi .'-'. $i++ . '">' . "\n<unstructured_citation>"; }, $artlit); $str .= $artlit; echo $str;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dLfcf
function name:  (null)
number of ops:  19
compiled vars:  !0 = $artlit, !1 = $doi, !2 = $i, !3 = $str
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '%3Cul%3E%0A%3Cli%3EAliev+BF.%3C%2Fli%3E%0A%3Cli%3EZyzov+IM%2C+Gazhva+SI.%3C%2Fli%3E%0A%3Cli%3EMamedzade+RE.%3C%2Fli%3E%0A%3Cli%3EMitronin+AV%2C+Platonova+ASh%3C%2Fli%3E%0A%3Cli%3ENasirova+HB.%3C%2Fli%3E%0A%3C%2Ful%3E'
   11     1        ASSIGN                                                       !1, '2129-8124-2022-3-81-7-12'
   12     2        ASSIGN                                                       !2, 0
   13     3        ASSIGN                                                       !3, ''
   15     4        FRAMELESS_ICALL_3                str_replace         ~8      <array>, <array>
          5        OP_DATA                                                      !0
          6        ASSIGN                                                       !0, ~8
   16     7        INIT_FCALL                                                   'preg_replace_callback'
          8        SEND_VAL                                                     '%2F%3Cli%3E%2F'
          9        DECLARE_LAMBDA_FUNCTION                              ~10     [0]
         10        BIND_LEXICAL                                                 ~10, !1
         11        BIND_LEXICAL                                                 ~10, !2
         12        SEND_VAL                                                     ~10
         13        SEND_VAR                                                     !0
         14        DO_ICALL                                             $11     
         15        ASSIGN                                                       !0, $11
   17    16        ASSIGN_OP                                         8          !3, !0
   19    17        ECHO                                                         !3
   20    18      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dLfcf
function name:  {closure:/in/dLfcf:16}
number of ops:  11
compiled vars:  !0 = $m, !1 = $doi, !2 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E >   RECV                                                 !0      
          1        BIND_STATIC                                                  !1
          2        BIND_STATIC                                                  !2
          3        CONCAT                                               ~3      '%3Ccitation+key%3D%22key-', !1
          4        CONCAT                                               ~4      ~3, '-'
          5        POST_INC                                             ~5      !2
          6        CONCAT                                               ~6      ~4, ~5
          7        CONCAT                                               ~7      ~6, '%22%3E'
          8        CONCAT                                               ~8      ~7, '%0A%3Cunstructured_citation%3E'
          9      > RETURN                                                       ~8
         10*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
169.19 ms | 2013 KiB | 14 Q