note 103353 added to function.hexdec
| From: | luisfc at setic dot ufsc dot br | Date: | Fri, 08 Apr 2011 20:51:15 +0000 |
| Subject: | note 103353 added to function.hexdec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-178647@lists.php.net to get a copy of this message | ||
Here is a function to transform a MAC Address to decimal.
function get_mac_decimal($mac) {
$invalid = array(":", "-", ";", ".", " ");
$clear_mac = str_replace($invalid, "", $mac);
$mac_decimal = "";
for ($i = 0; $i < strlen($clear_mac); $i = $i + 2) {
$mac_decimal .= hexdec(substr($clear_mac, $i, 2));
if ($i < strlen($clear_mac) - 2) {
$mac_decimal .= ".";
}
}
return $mac_decimal;
}
----
Server IP: 187.16.23.128
Probable Submitter: 150.162.248.35
----
Manual Page -- http://www.php.net/manual/en/function.hexdec.php
Edit -- https://master.php.net/note/edit/103353
Del: integrated -- https://master.php.net/note/delete/103353/integrated
Del: useless -- https://master.php.net/note/delete/103353/useless
Del: bad code -- https://master.php.net/note/delete/103353/bad+code
Del: spam -- https://master.php.net/note/delete/103353/spam
Del: non-english -- https://master.php.net/note/delete/103353/non-english
Del: in docs -- https://master.php.net/note/delete/103353/in+docs
Del: other reasons-- https://master.php.net/note/delete/103353
Reject -- https://master.php.net/note/reject/103353
Search -- https://master.php.net/manage/user-notes.php