wc_string_to_bool()
Converts a string (e.g. 'yes' or 'no') to a bool.
Хуков нет.
Возвращает
true|false
.
Использование
wc_string_to_bool( $string );
- $string(строка|true|false) (обязательный)
- String to convert. If a bool is passed it will be returned as-is.
Список изменений
С версии 3.0.0 | Введена. |
Код wc_string_to_bool() wc string to bool WC 8.7.0
function wc_string_to_bool( $string ) { $string = $string ?? ''; return is_bool( $string ) ? $string : ( 'yes' === strtolower( $string ) || 1 === $string || 'true' === strtolower( $string ) || '1' === $string ); }