3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $txt = "resultCode:NoOp errorMessage:null processMessage:2014-08-07 03:33:01:705 INFO begin appName=ixp_app appVersion=2012_11_v01 integrationCode= clientId=999999 userName=autosuggest1 docId=12956633 docType=RFQ recipientId=54784 encodingTypeCode=UTF-8 2014-08-07 03:33:01:706 DEBUG Opening connection to the database 2014-08-07 03:33:01:706 DEBUG Validating client's account 2014-08-07 03:33:01:712 DEBUG Reading original document details from database 2014-08-07 03:33:01:712 DEBUG Reading Header from Database 2014-08-07 03:33:01:715 DEBUG Reading Line Items from Database 2014-08-07 03:33:01:719 DEBUG Reading Party Contacts from Database 2014-08-07 03:33:01:721 DEBUG Constructing Interchange 2014-08-07 03:33:01:721 DEBUG Constructing Request For Quote 2014-08-07 03:33:01:724 DEBUG Constructing Dates 2014-08-07 03:33:01:725 DEBUG Constructing References 2014-08-07 03:33:01:725 DEBUG Constructing Comments 2014-08-07 03:33:01:725 DEBUG Constructing Parties 2014-08-07 03:33:01:726 DEBUG Constructing Line Items 2014-08-07 03:33:01:726 DEBUG Saving original document content to file - raw 2014-08-07 03:33:01:740 INFO Found 1 possible RFQ matches with a Reference No.: 14/449 that was forwarded by Match Buyer 11107 to Supplier 54784 2014-08-07 03:33:01:740 INFO RFQ with Internal Ref No.: 12870348 2014-08-07 03:33:01:740 INFO RFQ 12956633 will now be compared with the list of possible RFQ matches 2014-08-07 03:33:01:740 INFO Comparing RFQ 12956633 with RFQ 12870348 2014-08-07 03:33:01:740 DEBUG Reading Header from Database 2014-08-07 03:33:01:742 DEBUG Reading Line Items from Database 2014-08-07 03:33:01:744 DEBUG Reading Party Contacts from Database 2014-08-07 03:33:01:754 DEBUG Constructing Interchange 2014-08-07 03:33:01:754 DEBUG Constructing Request For Quote 2014-08-07 03:33:01:756 DEBUG Constructing Dates 2014-08-07 03:33:01:756 DEBUG Constructing References 2014-08-07 03:33:01:756 DEBUG Constructing Comments 2014-08-07 03:33:01:756 DEBUG Constructing Parties 2014-08-07 03:33:01:757 DEBUG Constructing Line Items 2014-08-07 03:33:01:758 DEBUG Doc Changed on Actual Line Item Count 2014-08-07 03:33:01:758 DEBUG 1 not equal to 7 2014-08-07 03:33:01:758 DEBUG Committing database transaction 2014-08-07 03:33:01:758 DEBUG Closing connection to the database 2014-08-07 03:33:01:759 INFO end status=NOOP filename=999999_20140807033301_7b536076 elapsed=53ms fileContents:null "; $lines = explode(PHP_EOL, $txt); $userMessages= array(); foreach ($lines as $line) { //print $line . PHP_EOL . '---------' . PHP_EOL; // regexp is 'timestamp debug_level message' if (!preg_match( '/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}:\d{3} \w+ (.*)$/', $line, $matches )) { // top lines with no timestamp, safe to skip them continue; } $message = $matches[1]; $words = explode(' ', $message); if (empty($words)) { // single words are also skipped continue; } if (in_array(strtolower($words[0]), array( 'opening', 'validating', 'reading', 'constructing', 'saving', 'found', 'rfq', 'comparing', 'committing', 'closing', 'end' ))) { // skip know technical message continue; } $userMessages[] = $message; } print_r($userMessages);
based on QZ8lk
Output for 4.3.10 - 4.4.9, 5.0.2 - 7.1.0
Array ( [0] => Doc Changed on Actual Line Item Count [1] => 1 not equal to 7 )
Output for 4.3.0 - 4.3.9, 5.0.0 - 5.0.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/X1Rvv on line 50 Array ( )