PHP code example of option / mac

1. Go to this page and download the library: Download option/mac library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

option / mac example snippets


use Option\Mac\Mac;

// Any format will do; only hex digits is considered
$mac = Mac::factory("1234.5678.90AB");

// Output in various formats:
echo $mac;             // 01:23:45:67:89:AB
echo $mac->asColon();  // 01:23:45:67:89:AB
echo $mac->asDot();    // 0123.4567.89AB
echo $mac->asIEE802(); // 01-23-45-67-89-AB
echo $mac->asDash();   // 01-23-45-67-89-AB

// Keep the OUI but zero out the NIC.
echo $mac->vendor();   // 01-23-45-00-00-00