Skip to content

how can i get Broadcast Address and Network Address from a ip width mask #7

@netmou

Description

@netmou

add some code(32bit) like follow :
public function network()
{
return long2ip(ip2long($this->address) & ip2long($this->netmask()));
}

public function broadcast()
{
	return long2ip(ip2long($this->network()) | (~(ip2long($this->netmask()))));
}

public function inverse()
{
	return long2ip(~(ip2long('255.255.255.255') << (32 - $this->netbits)));
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions