3v4l.org

run code in 500+ 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 = 20
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 20
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
Branch analysis from position: 20
filename:       /in/bFa33
function name:  ProcessTicketPostHeaders
number of ops:  22
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, ->20
   15     3    >   ASSIGN                                                       !1, <array>
   16     4        FRAMELESS_ICALL_3                preg_replace        ~5      '%2F%5Cr%3F%5Cn+%2F', '+'
          5        OP_DATA                                                      !0
          6        ASSIGN                                                       !0, ~5
   17     7        FRAMELESS_ICALL_2                implode             ~7      '%7C', !1
          8        CONCAT                                               ~8      '%2F%5E%28', ~7
          9        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'
         10        ASSIGN                                                       !2, ~9
   18    11        INIT_FCALL                                                   'preg_match_all'
         12        SEND_VAR                                                     !2
         13        SEND_VAR                                                     !0
         14        SEND_REF                                                     !0
         15        DO_ICALL                                             $11     
         16      > JMPZ                                                         $11, ->20
   19    17    >   FETCH_DIM_R                                          ~12     !0, 0
         18        FRAMELESS_ICALL_2                implode             ~13     '%0A', ~12
         19        ASSIGN                                                       !0, ~13
   23    20    > > RETURN                                                       !0
   24    21*     > RETURN                                                       null

End of function processticketpostheaders

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
126.83 ms | 486 KiB | 10 Q