wc_bool_to_string

Converts a bool to a string.

Description

(string) wc_bool_to_string( (bool) $bool ); 

Returns (string)

yes or no

Parameters (1)

0. $bool (bool)
The bool.

Usage

  1. if ( !function_exists( 'wc_bool_to_string' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-formatting-functions.php'; 
  3.  
  4. // The bool. 
  5. $bool = true; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wc_bool_to_string($bool); 
  9.  

Defined (1)

The function is defined in the following location(s).

/includes/wc-formatting-functions.php  
  1. function wc_bool_to_string( $bool ) { 
  2. if ( ! is_bool( $bool ) ) { 
  3. $bool = wc_string_to_bool( $bool ); 
  4. return true === $bool ? 'yes' : 'no';