Description
Set a default value for an empty array[ index]
Usage
bw_default_empty_arr( $bw_array, $bw_index, $bw_field, $bw_default );Parameters
- $bw_array
- ( mixed ) optional –
- $bw_index
- ( mixed ) optional –
- $bw_field
- ( mixed ) optional –
- $bw_default
- ( mixed ) optional –
Returns
voidSource
File name: oik/includes/bobbcomp.phpLines:
1 to 12 of 12
function bw_default_empty_arr( $bw_array=NULL, $bw_index=NULL, $bw_field=NULL, $bw_default=NULL ) { $val = bw_array_get( $bw_array, $bw_index, NULL ); if ( empty( $val )) { bw_trace( $bw_field, __FUNCTION__, __LINE__, __FILE__, bw_default_empty_arr ); $val = bw_get_option( $bw_field ); bw_trace( $val, __FUNCTION__, __LINE__, __FILE__, bw_default_empty_arr ); if ( empty( $val )) $val = $bw_default; } bw_trace( $val, __FUNCTION__, __LINE__, __FILE__, "value" ); return( $val ); }View on GitHub View on Trac
Called by
1 to 2 of 2
Invoked by
Calls
1 to 4 of 4
- bw_array_get() – Return the array[index] or array->index (for an object) or a default value if not set
- bw_default_empty_arr() – Set a default value for an empty array[ index]
- bw_get_option() – Get the value of an option field
- bw_trace() – Log a simple trace record to the trace log file if tracing is active
