[Php 4, Php 5, Php 7, Php 8]
được xác định - kiểm tra xem một hằng số có tên đã cho có tồn tại không — Checks whether a given named constant exists
Sự mô tả
được xác định [chuỗi $constant_name
]: bool[string $constant_name
]: bool
Ghi chú::
Nếu bạn muốn xem nếu một biến tồn tại, hãy sử dụng isset [] như đã xác định [] chỉ áp dụng cho hằng số. Nếu bạn muốn xem một hàm có tồn tại hay không, hãy sử dụng function_exists [].isset[] as defined[] only applies to constants. If you want to see if a function exists, use function_exists[].
Thông số
constant_name
Tên liên tục.
Trả về giá trị
Trả về true
Nếu hằng số được đặt tên được cho bởi constant_name
đã được xác định, false
nếu không.true
if the named constant given by constant_name
has been defined, false
otherwise.
Ví dụ
Ví dụ #1 Kiểm tra hằng số
Xem thêm
- Xác định [] - Xác định một hằng số được đặt tên
- hằng số [] - Trả về giá trị của một hằng số
- get_defined_constants [] - Trả về một mảng kết hợp với tên của tất cả các hằng số và giá trị của chúng
- function_exists [] - return true nếu hàm đã cho đã được xác định
- Phần trên các hằng số
Daniel tại Neville Dot TK ¶ ¶
14 năm trước
My preferred way of checking if a constant is set, and if it isn't - setting it [could be used to set defaults in a file, where the user has already had the opportunity to set their own values in another.]
Dan.
Aschmidt tại Anamera Dot Net ¶
5 năm trước
constant_name
0
constant_name
1
constant_name
2
constant_name
3
constant_name
4
constant_name
5Tris+PHP tại tfconsulting dot com dot au ¶ ¶
13 năm trước
constant_name
6
constant_name
7
constant_name
8
constant_name
9
true
0
true
1
constant_name
5r dot hartung tại Roberthartung dot de ¶ ¶
12 năm trước
true
3
true
4
true
5
true
6Lars Lernestal ¶ ¶
11 năm trước
true
7
true
8
constant_name
5Shaun H ¶ ¶
14 năm trước
constant_name
0
constant_name
1
constant_name
5Aschmidt tại Anamera Dot Net ¶
5 năm trước
constant_name
3
constant_name
4
constant_name
5
constant_name
5Tris+PHP tại tfconsulting dot com dot au ¶ ¶
13 năm trước
constant_name
7
constant_name
8
constant_name
5r dot hartung tại Roberthartung dot de ¶ ¶
13 năm trước
false
0
0
1
2Lars Lernestal ¶ ¶
5 năm trước
3
4
5Tris+PHP tại tfconsulting dot com dot au ¶ ¶
13 năm trước
6
7
8
9
My preferred way of checking if a constant is set, and if it isn't - setting it [could be used to set defaults in a file, where the user has already had the opportunity to set their own values in another.]
0
constant_name
5r dot hartung tại Roberthartung dot de ¶ ¶
12 năm trước
My preferred way of checking if a constant is set, and if it isn't - setting it [could be used to set defaults in a file, where the user has already had the opportunity to set their own values in another.]
2
My preferred way of checking if a constant is set, and if it isn't - setting it [could be used to set defaults in a file, where the user has already had the opportunity to set their own values in another.]
3
My preferred way of checking if a constant is set, and if it isn't - setting it [could be used to set defaults in a file, where the user has already had the opportunity to set their own values in another.]
4
constant_name
5Lars Lernestal ¶ ¶
11 năm trước
My preferred way of checking if a constant is set, and if it isn't - setting it [could be used to set defaults in a file, where the user has already had the opportunity to set their own values in another.]
6
My preferred way of checking if a constant is set, and if it isn't - setting it [could be used to set defaults in a file, where the user has already had the opportunity to set their own values in another.]
7
constant_name
5