[Php 8]
str_ends_with - kiểm tra xem một chuỗi kết thúc bằng một chuỗi con nhất định — Checks if a string ends with a given substring
Sự mô tả
str_ends_with [chuỗi $haystack
, chuỗi $needle
]: bool[string $haystack
, string $needle
]: bool
Thông số
haystack
Chuỗi để tìm kiếm trong.
needle
Các nền tảng để tìm kiếm trong haystack
.
Trả về giá trị
Trả về true
nếu haystack
kết thúc bằng needle
,
The string ends with 'fence' "fence" was not found because the case does not match0 khác.
true
if haystack
ends with needle
, The string ends with 'fence' "fence" was not found because the case does not match0 otherwise.
Ví dụ
Ví dụ số 1 bằng cách sử dụng chuỗi trống The string ends with 'fence'
"fence" was not found because the case does not match
1
The string ends with 'fence' "fence" was not found because the case does not match2
Ví dụ trên sẽ xuất ra:
All strings end with the empty string
Ví dụ #2 hiển thị độ nhạy của trường hợp
The string ends with 'fence' "fence" was not found because the case does not match3
The string ends with 'fence' "fence" was not found because the case does not match4
The string ends with 'fence' "fence" was not found because the case does not match5
Ví dụ trên sẽ xuất ra:
The string ends with 'fence' "fence" was not found because the case does not match
Ví dụ #2 hiển thị độ nhạy của trường hợp
Ghi chú: This function is binary-safe.
Lưu ý: Hàm này an toàn cho nhị phân.
- Xem thêm
- str_contains [] - Xác định xem một chuỗi có chứa chuỗi con nhất định không
- str_starts_with [] - kiểm tra xem một chuỗi bắt đầu bằng một chuỗi con nhất định
- Stripos [] - Tìm vị trí của lần xuất hiện đầu tiên của chuỗi con không nhạy trong trường hợp trong chuỗi
- strrpos [] - Tìm vị trí của lần xuất hiện cuối cùng của chuỗi con trong chuỗi
- strripos [] - Tìm vị trí của lần xuất hiện cuối cùng của chuỗi con không nhạy cảm trường hợp trong chuỗi
- strstr [] - Tìm lần xuất hiện đầu tiên của chuỗi
- strpbrk [] - Tìm kiếm một chuỗi cho bất kỳ bộ ký tự nào
- subtr [] - trả về phần của chuỗi
preg_match [] - Thực hiện phù hợp với biểu thức thông thường ¶
javalc6 tại gmail dot com
The string ends with 'fence' "fence" was not found because the case does not match6
The string ends with 'fence' "fence" was not found because the case does not match7
The string ends with 'fence' "fence" was not found because the case does not match8
1 năm trước ¶
thần thánh76 tại gmail dot com ¶
The string ends with 'fence' "fence" was not found because the case does not match9
$haystack
0
The string ends with 'fence' "fence" was not found because the case does not match8
11 thàng trước ¶
thần thánh76 tại gmail dot com ¶
$haystack
2
$haystack
3
$haystack
4
The string ends with 'fence' "fence" was not found because the case does not match8
11 thàng trước ¶
Tái khẳng định ¶
$haystack
6
$haystack
7
The string ends with 'fence' "fence" was not found because the case does not match8
Billynoah tại Gmail Dot Com ¶ ¶
19 ngày trước
$haystack
9
$needle
0
The string ends with 'fence' "fence" was not found because the case does not match8