TAILIEUCHUNG - Sams Teach Yourself PHP, MySQL and Apache in 24 Hours phần 6

Mặc dù chức năng này làm cho các chữ cái đầu tiên của mỗi từ chữ hoa, nó không chạm vào bất cứ thư khác. Vì vậy, nếu người dùng đã có vấn đề với phím Shift trong ví dụ trước và trình Violet Elizabeth Bott, cách tiếp cận của chúng tôi sẽ không làm nhiều để sửa chữa các chuỗi. | print membership br prints mz02xyz PHP also provides a case function that has a useful cosmetic purpose. The ucwords function makes the first letter of every word in a string uppercase. In the following snippet we make the first letter of every word in a user-submitted string uppercase full_name violet elizabeth bott full_name ucwords full_name print full_name prints Violet Elizabeth Bott Although this function makes the first letter of each word uppercase it does not touch any other letters. So if the user had had problems with her Shift key in the previous example and submitted VIolEt eLIZaBeTH bOTt our approach would not have done much to fix the string. We would have ended up with VIolEt ELIZaBeTH BOTt which isn t much of an improvement. We can deal with this problem by making the submitted string lowercase with strtolower before invoking ucwords full_name VIolEt eLIZaBeTH bOTt full_name ucwords strtolower full_name print full_name prints Violet Elizabeth Bott Wrapping Text with wordwrap and ni2br When you present plain text within a Web page you are often faced with the problem that newlines are not displayed and your text runs together into a featureless blob. The nl2br function is a convenience method that converts every newline into an HTML break. So string one line n string . another line n string . a third for luck n print nl2br string will print one line br another line br a third for luck br Notice that the br tags are output in XHTML-compliant form. This feature was introduced in PHP . The nl2br function is great for honoring newlines that are already in the text you are converting. Occasionally though you may want to add arbitrary line breaks to format a column of text. The wordwrap function is perfect for this task. wordwrap requires one argument the string to be transformed. By default wordwrap wraps lines every 75 characters and uses n as its line break character. So the code snippet string Given a long line wordwrap is useful as a means of .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.