3v4l.org

run code in 500+ 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:  15
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        FRAMELESS_ICALL_2                implode             ~8      '%0A', !1
         12        ASSIGN                                                       !2, ~8
   15    13        ECHO                                                         !2
   16    14      > RETURN                                                       1


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

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
162.34 ms | 2091 KiB | 15 Q