Monday, January 20, 2014

PHP Function To Convert CIDR To Netmask

<?php
function cidr2mask($cidr) {
     return long2ip(-1 << (32 - (int)$cidr));
}
?>