コード例 #1
0
ファイル: db.php プロジェクト: rommelsantor/RawMVC
 /**
  *
  */
 public static function get_var($i_table, $i_column, array $i_opts = [])
 {
     if (!has_str('COUNT', $i_column, false)) {
         if (strpos(@$i_opts['limit'], ',') !== false) {
             $i_opts['limit'] = explode(',', $i_opts['limit'])[0] . ',1';
         } else {
             $i_opts['limit'] = 1;
         }
     }
     return self::get_col($i_table, $i_column, $i_opts)[0];
 }
コード例 #2
0
ファイル: global.php プロジェクト: rommelsantor/RawMVC
/**
 *
 */
function has_str($i_needle, $i_haystack, $i_insensitive = true)
{
    $func = $i_insensitive ? 'stripos' : 'strpos';
    if (is_scalar($i_haystack)) {
        return $func($i_haystack, $i_needle) !== false;
    }
    if (is_array($i_haystack)) {
        foreach ($i_haystack as $el) {
            if (has_str($i_needle, $el)) {
                return true;
            }
        }
    }
    return false;
}