Advertisement
jiue123

syntax trim() PHP

Sep 29th, 2014
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.35 KB | None | 0 0
  1. hàm trim dùng xóa một số ký tự ta muốn
  2. VD1:
  3. $str = "Hello World!";
  4. echo trim($str,"Hed!");
  5.  
  6. result: llo Worl
  7.  
  8. VD2: nếu không có tham số thứ 2 hàm trim sẻ xóa một sô ký tự như (" ", \t, \n, \r, \0, \x0B).
  9. $text   = "\t\tThese are a few words :) ...  ";
  10. $trimmed = trim($text);
  11.  
  12. result: These are a few words :) ...123
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement