I have to convert many, many known MAC strings (always 12 chars) via PHP in order to loop and lookup in tickets content if they exist in any of the three form.
They come at this format from our db : A0B0C0D0E0F0 (12 chars always).
I need some code to turn them into both A0:B0:C0:D0:E0:F0 and then A0-B0-C0-D0-E0-F0.
code would do something like
while ($row = mysqli_fetch_object($resultmac) {
if (strpos($ticket, $row->mac) !== false || strpos($ticket, //mac with ":"//) !== false || strpos($ticket, //mac with "-"//) !== false) {
echo "found match : ";
}
}
(I use "!== false" because i read here that it was a good way to do it)
Is there a better way then converting the string to an array and manually add ":" or "-" after each sets of two chars?