array_search acting unpredictably
<p>I have a simple function that looks at an incoming mySQL data type and then rolls it up to a "category" (called a family in this code) so that I can apply default values at the category level. Anyway, this code works fine for finding integer, character, and text categories but completely fails on datetime and decimal categories. I'm at my wits end. Any help would be greatly appreciated:</p>

<pre><code>public static function get_family_type ( $col_type ) {
    $families = array (
                'integer' =&gt; array ( 'integer', 'int', 'tinyint', 'mediumint', 'bigint' ),
                'fixed' =&gt; array ( 'decimal', 'numeric' ),
                'floating' =&gt; array ( 'float' , 'double' ),
                'character' =&gt; array ( 'char', 'varchar' ),
                'datetime' =&gt; array ( 'datetime' , 'timestamp'),
                'time' =&gt; array ('time'),
                'date' =&gt; array ('year'),
                'text' =&gt; array ('tinytext', 'text', 'mediumtext' , 'longtext'),
                'blob' =&gt; array ('blob','tinyblob','mediumblob','longblob')
    );

    // first get rid of any optional length parameterisation
    list ( $col_type ) = explode ( "(" , $col_type , 2 );
    foreach ($families as $family =&gt; $family_members) {
        if ( array_search ( $col_type , $family_members , true ) ) {
            return $family;
        }
    }
    return "unknown $col_type";
}
</code></pre>

<p>note the backup return statement on the last line and then look at this output from a table I've defined elsewhere in code.</p>

<pre><code>    [18-Jun-2012 17:39:24] Getting default for family of integer
    [18-Jun-2012 17:39:24] Getting default for family of text
    [18-Jun-2012 17:39:24] Getting default for family of character
    [18-Jun-2012 17:39:24] Getting default for family of character
    [18-Jun-2012 17:39:24] Getting default for family of character
    [18-Jun-2012 17:39:24] Getting default for family of character
    [18-Jun-2012 17:39:24] Getting default for family of character
    [18-Jun-2012 17:39:24] Getting default for family of character
    [18-Jun-2012 17:39:24] Getting default for family of character
    [18-Jun-2012 17:39:24] Getting default for family of character
    [18-Jun-2012 17:39:24] Getting default for family of character
    [18-Jun-2012 17:39:24] Getting default for family of integer
    [18-Jun-2012 17:39:24] Getting default for family of integer
    [18-Jun-2012 17:39:24] Getting default for family of unknown decimal
    [18-Jun-2012 17:39:24] Getting default for family of character
    [18-Jun-2012 17:39:24] Getting default for family of unknown datetime
    [18-Jun-2012 17:39:24] Getting default for family of floating
</code></pre>
