note 106378 added to function.dechex
| From: | 9381904 at gmail dot com | Date: | Wed, 02 Nov 2011 06:45:13 +0000 |
| Subject: | note 106378 added to function.dechex | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-184274@lists.php.net to get a copy of this message | ||
was a small error in the previous script...
dec to hex mac address revised script:
<?php
function dec2mac($mac) {
$mac=preg_split("([.])", $mac, 6);
$hexmac="";
foreach ($mac as $part)
{
$part=dechex($part);
strlen($part)<2 ? $hexmac.="0$part" : $hexmac.=$part;
}
return $hexmac;
}
echo dec2mac("0.29.96.71.60.137"); // 001d60473c89
?>
----
Server IP: 69.147.83.197
Probable Submitter: 87.248.230.4
----
Manual Page -- http://www.php.net/manual/en/function.dechex.php
Edit -- https://master.php.net/note/edit/106378
Del: integrated -- https://master.php.net/note/delete/106378/integrated
Del: useless -- https://master.php.net/note/delete/106378/useless
Del: bad code -- https://master.php.net/note/delete/106378/bad+code
Del: spam -- https://master.php.net/note/delete/106378/spam
Del: non-english -- https://master.php.net/note/delete/106378/non-english
Del: in docs -- https://master.php.net/note/delete/106378/in+docs
Del: other reasons-- https://master.php.net/note/delete/106378
Reject -- https://master.php.net/note/reject/106378
Search -- https://master.php.net/manage/user-notes.php