try if ( undernet isin $network ) {} or something like that