3v4l.org

run code in 300+ 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:  22
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        INIT_FCALL                                               'str_replace'
          5        SEND_VAL                                                 <array>
          6        SEND_VAL                                                 <array>
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $8      
          9        ASSIGN                                                   !0, $8
   16    10        INIT_FCALL                                               'preg_replace_callback'
         11        SEND_VAL                                                 '%2F%3Cli%3E%2F'
         12        DECLARE_LAMBDA_FUNCTION                          ~10     [0]
         13        BIND_LEXICAL                                             ~10, !1
         14        BIND_LEXICAL                                             ~10, !2
         15        SEND_VAL                                                 ~10
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                         $11     
         18        ASSIGN                                                   !0, $11
   17    19        ASSIGN_OP                                     8          !3, !0
   19    20        ECHO                                                     !3
   20    21      > 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}
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.0.0


preferences:
137.93 ms | 1000 KiB | 15 Q