3v4l.org

run code in 300+ PHP versions simultaneously
<?php $t ='<body> <item>abc</item> <item>def</item> unparsable rest </body>'; $filtered = array_filter(explode("\n", $t), function($line) { $line = trim($line); return $line[0] == '<' && substr($line, -1) == '>'; }); $result = implode("\n", $filtered); echo $result;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Mt5eG
function name:  (null)
number of ops:  18
compiled vars:  !0 = $t, !1 = $filtered, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Cbody%3E%0A++++%3Citem%3Eabc%3C%2Fitem%3E%0A++++%3Citem%3Edef%3C%2Fitem%3E%0A++++unparsable+rest%0A%3C%2Fbody%3E'
    9     1        INIT_FCALL                                               'array_filter'
          2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '%0A'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $4      
          6        SEND_VAR                                                 $4
          7        DECLARE_LAMBDA_FUNCTION                          ~5      [0]
   12     8        SEND_VAL                                                 ~5
    9     9        DO_ICALL                                         $6      
         10        ASSIGN                                                   !1, $6
   14    11        INIT_FCALL                                               'implode'
         12        SEND_VAL                                                 '%0A'
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                         $8      
         15        ASSIGN                                                   !2, $8
   15    16        ECHO                                                     !2
   16    17      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 8, Position 2 = 14
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/Mt5eG
function name:  {closure}
number of ops:  16
compiled vars:  !0 = $line
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        INIT_FCALL                                               'trim'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4        ASSIGN                                                   !0, $1
   11     5        FETCH_DIM_R                                      ~3      !0, 0
          6        IS_EQUAL                                         ~4      ~3, '%3C'
          7      > JMPZ_EX                                          ~4      ~4, ->14
          8    >   INIT_FCALL                                               'substr'
          9        SEND_VAR                                                 !0
         10        SEND_VAL                                                 -1
         11        DO_ICALL                                         $5      
         12        IS_EQUAL                                         ~6      $5, '%3E'
         13        BOOL                                             ~4      ~6
         14    > > RETURN                                                   ~4
   12    15*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.71 ms | 1432 KiB | 18 Q