3v4l.org

run code in 300+ PHP versions simultaneously
<?php $String_Header = 'From support@test.co.uk Wed Nov 20 15:48:00 2013 Return-Path: <support@test.co.uk> X-Original-To: mailbox@my.domain.com Delivered-To: mailbox@my.domain.com Delivered-To: techinfo@test.co.uk from: "Lucy 1" <support@lucky1.co.uk>,"Lucy 2" <support@lucky2.co.uk>, "Lucy 3" <support@lucky3.co.uk> to: TestTo <techinfo@test.co.uk>'; function ProcessTicketPostHeaders($headers) { if (is_string($headers)) { $_headersWeWantToKeep = array("from", "to", "cc", "bcc"); $headers = preg_replace('/\r?\n /', ' ', $headers); $_pattern = '/^(' . implode('|', $_headersWeWantToKeep) . '):.*(?:\R(?!(?:(?1)|$)).*)*/m'; if (preg_match_all($_pattern, $headers, $headers)) { $headers = implode("\n", $headers[0]); } } return $headers; } echo '<pre>'; print_r(ProcessTicketPostHeaders($String_Header));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bFa33
function name:  (null)
number of ops:  9
compiled vars:  !0 = $String_Header
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'From+support%40test.co.uk++Wed+Nov+20+15%3A48%3A00+2013%0AReturn-Path%3A+%3Csupport%40test.co.uk%3E%0AX-Original-To%3A+mailbox%40my.domain.com%0ADelivered-To%3A+mailbox%40my.domain.com%0ADelivered-To%3A+techinfo%40test.co.uk%0Afrom%3A+%22Lucy+1%22+%3Csupport%40lucky1.co.uk%3E%2C%22Lucy+2%22+%3Csupport%40lucky2.co.uk%3E%2C%0A%22Lucy+3%22+%3Csupport%40lucky3.co.uk%3E%0Ato%3A+TestTo+%3Ctechinfo%40test.co.uk%3E'
   26     1        ECHO                                                     '%3Cpre%3E'
   27     2        INIT_FCALL                                               'print_r'
          3        INIT_FCALL                                               'processticketpostheaders'
          4        SEND_VAR                                                 !0
          5        DO_FCALL                                      0  $2      
          6        SEND_VAR                                                 $2
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function processticketpostheaders:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 29
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 29
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
Branch analysis from position: 29
filename:       /in/bFa33
function name:  ProcessTicketPostHeaders
number of ops:  31
compiled vars:  !0 = $headers, !1 = $_headersWeWantToKeep, !2 = $_pattern
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   14     1        TYPE_CHECK                                   64          !0
          2      > JMPZ                                                     ~3, ->29
   15     3    >   ASSIGN                                                   !1, <array>
   16     4        INIT_FCALL                                               'preg_replace'
          5        SEND_VAL                                                 '%2F%5Cr%3F%5Cn+%2F'
          6        SEND_VAL                                                 '+'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $5      
          9        ASSIGN                                                   !0, $5
   17    10        INIT_FCALL                                               'implode'
         11        SEND_VAL                                                 '%7C'
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                         $7      
         14        CONCAT                                           ~8      '%2F%5E%28', $7
         15        CONCAT                                           ~9      ~8, '%29%3A.%2A%28%3F%3A%5CR%28%3F%21%28%3F%3A%28%3F1%29%7C%24%29%29.%2A%29%2A%2Fm'
         16        ASSIGN                                                   !2, ~9
   18    17        INIT_FCALL                                               'preg_match_all'
         18        SEND_VAR                                                 !2
         19        SEND_VAR                                                 !0
         20        SEND_REF                                                 !0
         21        DO_ICALL                                         $11     
         22      > JMPZ                                                     $11, ->29
   19    23    >   INIT_FCALL                                               'implode'
         24        SEND_VAL                                                 '%0A'
         25        FETCH_DIM_R                                      ~12     !0, 0
         26        SEND_VAL                                                 ~12
         27        DO_ICALL                                         $13     
         28        ASSIGN                                                   !0, $13
   23    29    > > RETURN                                                   !0
   24    30*     > RETURN                                                   null

End of function processticketpostheaders

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.94 ms | 1021 KiB | 18 Q