root
Specialist
1. cú pháp:
- Code:
- Kết quả:
PHP:
str_replace(find,replace,string,count)
- find: sẽ tìm chuỗi trong string
- replace: Nếu tìm thấy chuỗi cần tìm trong string thì thực hiện thay thế chuỗi tìm được bằng chuỗi mới replace
- String: chuỗi ban đầu
- Code:
PHP:
<?php
echo str_replace("world","Peter","Hello world!");
?>
HTML:
Hello Peter!
Bài viết liên quan