php tip

$str = “home::khanhpt::test.tar.gz”; $data = explode(“::”,$str); $data[0] = “root”; $name = join(“::”,$data); echo $name; You could use a regular express to remove everything apart from those characters you wish to keep: $string=preg_replace(‘/[^A-Za-z0-9 _-+&]/’,”,$string); Replaces everything that is not (^) the letters A-Z or a-z, the numbers 0-9, space, underscore, hypen, plus and ampersand – with … Read more