public static function formatMacAddress($validAddress)
    {
        if (strlen($validAddress) == 12) {
            $formattedAddress = substr($validAddress, 0, 2);
            for ($i=2; $i<12; $i+=2) {
                $formattedAddress .= ':'.substr($validAddress, $i, 2);
            }
            return $formattedAddress;
        }
        if (strlen($validAddress) == 17) {
            $formattedAddress = str_replace('-', ':', $validAddress);
            return $formattedAddress;
        }
    }
public static function formatMacAddress($validAddress)
    {
        if (strlen($validAddress) == 12) {
            $formattedAddress = substr($validAddress, 0, 2);
            for ($i=2; $i<12; $i+=2) {
                $formattedAddress .= ':'.substr($validAddress, $i, 2);
            }
            return $formattedAddress;
        }
        if (strlen($validAddress) == 17) {
            $formattedAddress = str_replace('-', ':', $validAddress);
            return $formattedAddress;
        }
    }
public static function formatMacAddress ( $ validAddress ) { if ( strlen ( $ validAddress ) == 12 ) { $ formattedAddress = substr ( $ validAddress , 0 , 2 ) ; for ( $ i = 2 ; $ i < 12 ; $ i += 2 ) { $ formattedAddress .= ':' . substr ( $ validAddress , $ i , 2 ) ; } return $ formattedAddress ; } if ( strlen ( $ validAddress ) == 17 ) { $ formattedAddress = str_replace ( '-' , ':' , $ validAddress ) ; return $ formattedAddress ; } }
Formats a MAC Address.

This function accepts MAC addresses in one of the following valid
formats:

- aabbccddeeff
- aa-bb-cc-dd-ee-ff
- aa:bb:cc:dd:ee:ff

It returns the address formatted like this: aa:bb:cc:dd:ee:ff.

@param string $validAddress

@return string|null
Formats a MAC Address .