= $seek) { if (($seek = strpos($episodeActionString, 'EpisodeAction{', $seek)) === false) { continue; } preg_match( '/EpisodeAction{(podcast=\')(?.*?)(\', episode=\')(?.*?)(\', action=)(?.*?)(, timestamp=)(?.*?)(, started=)(?.*?)(, position=)(?.*?)(, total=)(?.*?)}]*/', substr($episodeActionString, $seek), $matches ); // change for next iteration $seek++; array_push($episodeActions, new EpisodeAction( $matches["podcast"], $matches["episode"], $matches["action"], $matches["timestamp"], (int)$matches["started"], (int)$matches["position"], (int)$matches["total"], )); } return $episodeActions; } }