3v4l.org

run code in 300+ PHP versions simultaneously
<?php $lines = explode(PHP_EOL, "014-08-11 02:21:02:737 DEBUG Constructing Line Items 2014-08-11 02:21:02:739 ERROR [ActualLineItemCountMismatchEx] Doc Changed on Actual Line Item Count 2014-08-11 02:21:02:739 ERROR [ActualLineItemCountMismatchEx] 7 not equal to 2 2014-08-11 02:21:02:739 DEBUG Committing database transaction 2014-08-11 02:21:02:739 DEBUG Closing connection to the database "); $userMessages = array(); $errors = array( 'RFQReferenceNumberMismatchEx' => "Document Header Reference Number Value Mismatch", 'LineItemDescriptionMismatchEx' => "Line Item Description Mismatch", 'ActualLineItemCountMismatchEx' => "Actual Line Item Count Mismatch", 'LineItemCountMismatchEx' => "Document Header Line Item Count Attribute Value Mismatch", 'NoMatchingRFQWithRefenceFoundEx' => "There is no RFQ with a Reference No.: <refnumber> found within the last <no.ofdays>days that was sent by Buyer <buyertnid> to Match Supplier <matchsuppliertnid> that was forwarded by Match Buyer <matchbuyertnid> to Supplier <suppliertnid>", 'MatchFieldListNotFoundEx' => "The list of fields that will be used for matching is not set in the database", 'Unknown' => 'Other errors' ); foreach ($lines as $line) { if (!preg_match('/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}:\d{3} ERROR \[(\w+)\] (.*)$/', $line, $matches)) { continue; } $errorCode = $matches[1]; $errorDetails = $matches[2]; if (!array_key_exists($errorCode, $errors)) { $errorCode = 'Unknown'; } if (array_key_exists($errorCode, $userMessages)) { $userMessages[$errorCode]['details'][] = $errorDetails; } else { $userMessages[$errorCode] = array( 'error' => $errors[$errorCode], 'details' => array( $errorDetails ) ); } } var_dump($userMessages);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 39
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 39
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 17
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 25
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 32
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 25
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
filename:       /in/4DUQE
function name:  (null)
number of ops:  44
compiled vars:  !0 = $lines, !1 = $userMessages, !2 = $errors, !3 = $line, !4 = $matches, !5 = $errorCode, !6 = $errorDetails
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'explode'
          1        SEND_VAL                                                 '%0A'
          2        SEND_VAL                                                 '014-08-11+02%3A21%3A02%3A737+DEBUG+Constructing+Line+Items%0A2014-08-11+02%3A21%3A02%3A739+ERROR+%5BActualLineItemCountMismatchEx%5D+Doc+Changed+on+Actual+Line+Item+Count%0A2014-08-11+02%3A21%3A02%3A739+ERROR+%5BActualLineItemCountMismatchEx%5D+7+not+equal+to+2%0A2014-08-11+02%3A21%3A02%3A739+DEBUG+Committing+database+transaction%0A2014-08-11+02%3A21%3A02%3A739+DEBUG+Closing+connection+to+the+database%0A'
          3        DO_ICALL                                         $7      
          4        ASSIGN                                                   !0, $7
    9     5        ASSIGN                                                   !1, <array>
   11     6        ASSIGN                                                   !2, <array>
   21     7      > FE_RESET_R                                       $11     !0, ->39
          8    > > FE_FETCH_R                                               $11, !3, ->39
   22     9    >   INIT_FCALL                                               'preg_match'
         10        SEND_VAL                                                 '%2F%5E%5Cd%7B4%7D-%5Cd%7B2%7D-%5Cd%7B2%7D+%5Cd%7B2%7D%3A%5Cd%7B2%7D%3A%5Cd%7B2%7D%3A%5Cd%7B3%7D+ERROR+%5C%5B%28%5Cw%2B%29%5C%5D+%28.%2A%29%24%2F'
         11        SEND_VAR                                                 !3
         12        SEND_REF                                                 !4
         13        DO_ICALL                                         $12     
         14        BOOL_NOT                                         ~13     $12
         15      > JMPZ                                                     ~13, ->17
   23    16    > > JMP                                                      ->8
   26    17    >   FETCH_DIM_R                                      ~14     !4, 1
         18        ASSIGN                                                   !5, ~14
   27    19        FETCH_DIM_R                                      ~16     !4, 2
         20        ASSIGN                                                   !6, ~16
   29    21        ARRAY_KEY_EXISTS                                 ~18     !5, !2
         22        BOOL_NOT                                         ~19     ~18
         23      > JMPZ                                                     ~19, ->25
   30    24    >   ASSIGN                                                   !5, 'Unknown'
   33    25    >   ARRAY_KEY_EXISTS                                         !5, !1
         26      > JMPZ                                                     ~21, ->32
   34    27    >   FETCH_DIM_W                                      $22     !1, !5
         28        FETCH_DIM_W                                      $23     $22, 'details'
         29        ASSIGN_DIM                                               $23
         30        OP_DATA                                                  !6
         31      > JMP                                                      ->38
   37    32    >   FETCH_DIM_R                                      ~26     !2, !5
         33        INIT_ARRAY                                       ~27     ~26, 'error'
   39    34        INIT_ARRAY                                       ~28     !6
         35        ADD_ARRAY_ELEMENT                                ~27     ~28, 'details'
   36    36        ASSIGN_DIM                                               !1, !5
   39    37        OP_DATA                                                  ~27
   21    38    > > JMP                                                      ->8
         39    >   FE_FREE                                                  $11
   45    40        INIT_FCALL                                               'var_dump'
         41        SEND_VAR                                                 !1
         42        DO_ICALL                                                 
         43      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.14 ms | 1400 KiB | 19 Q