Hàm ctype_space[] trong PHP được sử dụng để kiểm tra xem từng và mọi ký tự của chuỗi có phải là ký tự khoảng trắng hay không. Nó trả về True nếu tất cả các ký tự là khoảng trắng, ngược lại trả về Sai
cú pháp
ctype_space[string text]
Tham số được sử dụng
- chữ. - Là tham số bắt buộc chỉ định chuỗi
Giá trị trả về.
Trả về TRUE nếu mỗi ký tự trong văn bản chứa khoảng trắng, ngược lại trả về false. ký tự trống, ký tự này cũng bao gồm các ký tự tab, xuống dòng, tab dọc, nguồn cấp dữ liệu theo dòng và nguồn cấp dữ liệu biểu mẫu.
ví dụ
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space
Các chương trình dưới đây minh họa hàm ctype_space[].
Chương trình 1. lấy một chuỗi
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space0
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space1
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space2
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space3
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space4
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space0
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space1____12
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space3
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space4
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space5
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space4
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space7
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space8
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space9
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space00
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space2
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space02
________ 18 ________ 19 ________ 105 ________ 106
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space07
đầu ra.
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space0
Chương trình. 2 Lấy một mảng chuỗi và kiểm tra khoảng trắng bằng hàm ctype_space[]
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space0
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space1
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space90
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space3
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space92
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space0
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space94
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space95
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space31
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space97
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space33
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space97
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space35
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space97
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space70
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space71
Điều @Mittineague đang nói là thuộc tính
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space3 của bạn ở dạng cấp một, nơi bạn yêu cầu mật khẩu mới, không chỉ định phải làm gì khi người dùng nhấn nút. Thông thường bạn sẽ chỉ định điều đó trong thông số “hành động”
Input : \r Output : Yes Explanation: \r is create white space Input : abc\r Output : No Explanation: characters "abc" are not white space9
Tôi đã thấy rằng không có hành động nào và cho rằng đó là một loại tốc ký nào đó để tải lại cùng một trang
Tôi không thấy bất cứ thứ gì xuất ra nút nữa. Có một cái gì đó thiếu từ bài viết của bạn?
Việc thêm nhiều khoảng trắng và ngắt dòng trong mã PHP rất quan trọng để định dạng và hiển thị văn bản chính xác trên trang web. Các chuỗi từ phần mềm khác có thể đang sử dụng các ký tự giãn cách khác nhau và cần được chuyển đổi thành thẻ HTML. Thật không may, một số kiến trúc máy tính sử dụng các ký tự giãn cách khác với các kiến trúc khác. Việc tạo khoảng trắng trong PHP được thực hiện chủ yếu thông qua chức năng "echo"
Bước 1
Mở tệp PHP trong trình soạn thảo văn bản, chẳng hạn như Windows Notepad
Video trong ngày
Bước 2
Thêm một khoảng trắng giữa các biến PHP bằng cách thêm mã "echo $variable1. "". biến $2;. "
Bước 3
Thêm nhiều khoảng trắng bằng cách thêm mã "echo $variable1. " ". biến $2;. " Thực thể " " đại diện cho một khoảng trắng không ngắt. Việc sử dụng " " thường xuyên không hoạt động vì trình duyệt web thu gọn nhiều khoảng trắng thành một