john_doemoor Posted June 13, 2012 Share Posted June 13, 2012 So my issue is, that i have this function: public function parseLogLines($logLines, $householdId) { $logLinesArray = array(); foreach(preg_split("/\n|\r/", $logLines) as $logLine) { if (preg_match("/$householdId/", $logLine) > 0) { $logLineArray = preg_split("/,/",$logLine, 2, PREG_SPLIT_NO_EMPTY); $index = (int)$logLineArray[0]; $content = $logLineArray[1]; $logLinesArray[$index] = $content; } } return $logLinesArray; } which goes thru loglines and if they match stores them to array. then i have this function: public function getUserLogLines($logLines, $householdId) { $this->userLogLines = $this->userLogLines + $this->parseLogLines($logLines, $householdId); return $this->userLogLines; } which goes thru new log entries and remembers them. How can i make that last function to find a part of a string from value? Other issue is how to make the first function to parse also those loglines which include the part of string parsed from value? Quote Link to comment https://forums.phpfreaks.com/topic/264101-finding-part-of-a-string-from-arrays-values-and-parsing-values-that-contain-them/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.