String Function engToBoolean()

function engToBoolean(

Name in Zenario 8



Takes a string, and returns either a 1 or a 0 depending on whether the string looks affirmative or negative.

Available in both PHP and JavaScript.

Where You Can Use It

From Zenario 7.0.0 onwards.

Return Value

Returns a 0 if $text is empty, false, null, undefined, zero, false, "off" or "no". Otherwise it returns 1.

Note that $text is case insensitive, so "YES", "Yes" and "yes" would all return 1, and "NO", "No" and "no" would all return 0.