3v4l.org

run code in 500+ PHP versions simultaneously
<?php $str = '<?xml version="1.0" encoding="utf-8"?> <products> <item> <ItemID>01</ItemID> <ItemName>Book</ItemName> </item> <Product> <ProductID>01</ProductID> <ProductName>Paper</ProductName> </Product>'; $lines = explode("\n", $str); echo implode("\n", array_map(function ($line) { $trimmedLine = trim($line); if ($trimmedLine == "<Product>") { return $trimmedLine; } return $line; }, $lines));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2ab10
function name:  (null)
number of ops:  14
compiled vars:  !0 = $str, !1 = $lines
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, '%3C%3Fxml+version%3D%221.0%22+encoding%3D%22utf-8%22%3F%3E%0A%3Cproducts%3E%0A++%3Citem%3E%0A++++%3CItemID%3E01%3C%2FItemID%3E%0A++++%3CItemName%3EBook%3C%2FItemName%3E%0A++%3C%2Fitem%3E%0A++%3CProduct%3E%0A++++%3CProductID%3E01%3C%2FProductID%3E%0A++++%3CProductName%3EPaper%3C%2FProductName%3E%0A++%3C%2FProduct%3E'
   13     1        INIT_FCALL                                                   'explode'
          2        SEND_VAL                                                     '%0A'
          3        SEND_VAR                                                     !0
          4        DO_ICALL                                             $3      
          5        ASSIGN                                                       !1, $3
   15     6        INIT_FCALL                                                   'array_map'
          7        DECLARE_LAMBDA_FUNCTION                              ~5      [0]
   23     8        SEND_VAL                                                     ~5
          9        SEND_VAR                                                     !1
   15    10        DO_ICALL                                             $6      
         11        FRAMELESS_ICALL_2                implode             ~7      '%0A', $6
   23    12        ECHO                                                         ~7
         13      > 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 = 6
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2ab10
function name:  {closure:/in/2ab10:15}
number of ops:  8
compiled vars:  !0 = $line, !1 = $trimmedLine
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   RECV                                                 !0      
   16     1        FRAMELESS_ICALL_1                trim                ~2      !0
          2        ASSIGN                                                       !1, ~2
   18     3        IS_EQUAL                                                     !1, '%3CProduct%3E'
          4      > JMPZ                                                         ~4, ->6
   19     5    > > RETURN                                                       !1
   22     6    > > RETURN                                                       !0
   23     7*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
168.31 ms | 1921 KiB | 15 Q