Php 在已解析的项中插入空格

Php 在已解析的项中插入空格,php,parsing,Php,Parsing,我有一个有效的解析脚本。我把大部分工作外包出去,但只剩下一个小项目。我正在解析的页面呈现一个没有空格的邮政编码(这是不正确的)。所以,我需要在第三个字符后插入空格。我知道要这样做的字符串,但我不知道如何将其放入此代码部分: if(preg_match('/postal: (.*),/', $tempscript, $matches)) $temppostcode = $matches[1]; $postcode=str_replace('"','',substr($temppostcode,0,

我有一个有效的解析脚本。我把大部分工作外包出去,但只剩下一个小项目。我正在解析的页面呈现一个没有空格的邮政编码(这是不正确的)。所以,我需要在第三个字符后插入空格。我知道要这样做的字符串,但我不知道如何将其放入此代码部分:

if(preg_match('/postal: (.*),/', $tempscript, $matches))
$temppostcode = $matches[1];
$postcode=str_replace('"','',substr($temppostcode,0,strpos($temppostcode,'", ')));
$postcode = str_replace(' ','',$postcode);
$postcode = wordwrap($postcode, strlen($postcode)-3,' ', true);
我试图放入上面部分的字符串:

if(preg_match('/postal: (.*),/', $tempscript, $matches))
$temppostcode = $matches[1];
$postcode=str_replace('"','',substr($temppostcode,0,strpos($temppostcode,'", ')));
$postcode = str_replace(' ','',$postcode);
$postcode = wordwrap($postcode, strlen($postcode)-3,' ', true);

我只是不知道该把它放在第一部分的什么地方,或者我有什么选择。

我看不出问题,只是把你的代码放在那代码之后如果你经常压制传递html,你就把它外包给fool@popnoodles我试过了,没有effect@Dagon也许如果你看到了被解析的东西,你的评论可能有一定的正确性。大部分内容都可以解析为html,但页面的某些部分无法解析。@poplaines I stand correct!我试过了,但我先去掉了等号(??)前后的空格,效果很好。非常感谢。