wooccm_get_value_by_key

The WooCommerce Checkout Manager wooccm get value by key function.

Description

wooccm_get_value_by_key( $array, $key ); 

Parameters (2)

0. $array
The array.
1. $key
The key.

Usage

  1. if ( !function_exists( 'wooccm_get_value_by_key' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-checkout-manager/includes/classes/main.php'; 
  3.  
  4. // The array. 
  5. $array = null; 
  6.  
  7. // The key. 
  8. $key = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = wooccm_get_value_by_key($array, $key); 
  12.  

Defined (1)

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

/includes/classes/main.php  
  1. function wooccm_get_value_by_key($array, $key) { 
  2. foreach($array as $k=>$each) { 
  3. if($k==$key) { 
  4. return $each; 
  5. if(is_array($each)) { 
  6. if($return = wooccm_get_value_by_key($each, $key)) { 
  7. return $return;