PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of giulio   Mac Address   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example file
Class: Mac Address
Retrieve the Mac address of a network card
Author: By
Last change: php
Date: 12 years ago
Size: 690 bytes
 

Contents

Class file image Download
<?php

require_once (MacAddress.php");

$mac = new MacAddress ('00:FF:AB:CC:DD:FF');

echo
$mac->output ('.',4)."\n"; // 00FF.ABCC.DDFF

echo
$mac->output ('.',4,'lower')."\n"; // 00ff.abcc.ddff
echo
$mac->output ('-',2,'upper')."\n"; // 00-FF-AB-CC-DD-FF
echo
$mac->output (':',2,'lower')."\n"; // 00:ff:ab:cc:dd:ff

$mac2 = new MacAddress ($mac->GetMacAddr()); // mac of eth0 of my server
echo
$mac2->output (':',2,'lower')."\n"; // 00:50:56:ac:52:7b
echo
$mac2->output ('.',4,'lower')."\n"; // 0050.56ac.527b
echo
$mac2->output ('.',4,'upper')."\n"; // 0050.56AC.527B


?>