<?php
$var = "123 456 789";
//errado não vai imprimir nada
//substitui espaço por virgula
//substitui espaço por virgula mais espaço
PD9waHAKCiAgICR2YXIgPSAiMTIzIDQ1NiA3ODkiOwogCi8vZXJyYWRvIG7Do28gdmFpIGltcHJpbWlyIG5hZGEKZWNobyBzdHJfcmVwbGFjZSgkdmFyLCIgIiwiIikuUEhQX0VPTDsKCi8vc3Vic3RpdHVpIGVzcGHDp28gcG9yIHZpcmd1bGEKZWNobyBzdHJfcmVwbGFjZSgiICIsIiwiLCR2YXIpLlBIUF9FT0w7CgovL3N1YnN0aXR1aSBlc3Bhw6dvIHBvciB2aXJndWxhIG1haXMgZXNwYcOnbwplY2hvIHN0cl9yZXBsYWNlKCIgIiwiLCAiLCR2YXIpLlBIUF9FT0w7