Replace sed with pure php.