Skip to content

Instantly share code, notes, and snippets.

@riza
Created September 2, 2020 09:30
Show Gist options
  • Save riza/cb881b667f82ca83fb18b90cb20c61f5 to your computer and use it in GitHub Desktop.
Save riza/cb881b667f82ca83fb18b90cb20c61f5 to your computer and use it in GitHub Desktop.
The REAL Boolval
<?php
/*
*
*
*
*/
function _boolval($val) {
return $val === "true" ? true : ($val === true ? true : ($val === "false" ? false : ($val === false ? false : (is_numeric($val) ? (intval($val) >= 1 ? true : false) : (!empty($val) ? true : false)))));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment