顯示具有 string 標籤的文章。 顯示所有文章
顯示具有 string 標籤的文章。 顯示所有文章

2012-10-13

CODE - php 字串取代

example :
$path = '/home/nas/webhd_14/e2/c3/10107664/50012/sync/a3/string';
$path = preg_replace('/home\/nas/', 'net', $path);
# output: /net/webhd_14/e2/c3/10107664/50012/sync/a3/string
$str = 'hello.@.@world';
$key = preg_replace(array('/\./', '/\@/'), '_', $str);
# output: hello||||world