Background - Subnetting IPv4 With PHP
For many, upon many, of years, there has been a need to partition and segregate networks based on purpose, need or availability. To do so, engineers and network architects have been employing the use of subnetting. This gives you the ability to divide a larger network into many smaller networks. Although many tools already exist to do this, not many have been adapted for API use.
Note: The class below can be echoed into a JSON response by using the __toString()
magic method. This method loops through all the methods within the class, and will serialize them into JSON.
The Class, The Code
You can get a copy of the code below:
Example Usage
Code comments to follow. Share how you have been able to use the script above! Enjoy.