Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
protected static function getFieldFlags($what)
{
// Order of flags taken from http://lxr.php.net/xref/PHP_5_6/ext/mysql/php_mysql.c#2507
$constantFlagMap = [
MYSQLI_NOT_NULL_FLAG => "not_null",
MYSQLI_PRI_KEY_FLAG => "primary_key"
...
];
$flags = [];
foreach($constantFlagMap as $constant => $flag) {
if ($what & $constant) {
$flags[] = $flag;
}
}
return implode(" ", $flags);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment