bin (function)

Last updated: Fri, Jan 13, 2023 7:58 am
Return to Knowledgebase

Purpose

Echoes a green Yes, red No, or blue Other depending on what is passed to it.

Location

users/helpers/us_helpers.php

Parameters

# Parameter Data Type Required Description
1 $number int Yes Should be 0 or 1

Returns

Data Type Description of Returned Data
string An html colored string

Example

bin($user->data()->active);

Further Documentation:

Short for "binary," the bin function is great for all those tinyint(1) columns in the database. If you are representing these columns in a table, using bin will echo a green Yes if the number is 1 or a red No if it is 0. Anything else will echo a blue Other.