You appear to be a bot. Output may be restricted
Description
Validate as true or falseSimple function to validate a field as TRUE or FALSE given a big list of strings that represent TRUE
Usage
$bool = bw_validate_torf( $field, $trues, $falses );
Parameters
- $field
- ( string ) required – value to be validated. If null then the value returned is FALSE
- $trues
- ( string ) optional default: ,true,yes,1,on – list of TRUE values. Now includes "on" to allow for checkbox fields
- $falses
- ( string ) optional – list of FALSE values Note: No need for the $falses parameter at present
Returns
bool true or falseSource
File name: oik-bwtrace/libs/bobbfunc.phpLines:
1 to 13 of 13
function bw_validate_torf( $field, $trues=",true,yes,1,on", $falses=NULL ) { $torf = FALSE; if ( $field ) { $field = ",".strtolower( $field ); //bw_trace( $field, __FUNCTION__, __LINE__, __FILE__, "field" ); //bw_trace( $trues, __FUNCTION__, __LINE__, __FILE__, "trues" ); $pos = strpos( $trues, $field ); //bw_trace( $pos, __FUNCTION__, __LINE__, __FILE__, "pos" ); if ( $pos !== FALSE ) $torf = TRUE; } return( $torf ); }View on GitHub View on Trac