Coder Social home page Coder Social logo

php-mac-generator's Introduction

PHP-MAC-adress-generator

Have you ever wanted to generate MAC-adresses in PHP? This is a very simple script that I thought someone might find useful.

Installation

Download the file "randomMac.php" or the whole repository and include the file into your project. You can do so by using:

include "randomMac.php";

or

require "randomMac.php";

Alternatively you can copy the whole code into your script where you need it.

Usage

Basic usage

To get your random MAC-adress, just call the function like this:

randomMac():

In most cases you probaply would like to output your freshly generated MAC-adress or modify it further. You can output the MAC-adress using echo:

echo randomMac();

Or assign it to a variable:

$foo = randomMac():

Delimeters

You can change the delimeter by using the parameter when calling the function. By default the delimeter is a colon (":") See some examples below.

randomMac();
randomMac(" ");
randomMac("-");
randomMac(".");
randomMac("");

would result in

57:17:37:3B:59:40

27 B3 07 00 EA 9F

41-75-FE-74-B3-F6

E6.CF.57.CF.5B.AB

77A2FB10AABD

Conclusion

As you can see, it's very simple. If you have any questions, feel free to contact me :)

php-mac-generator's People

Contributors

makramc avatar

Watchers

 avatar

php-mac-generator's Issues

Add feature for other dot-formats

Some people and programs write MAC-addresses like this:
6F-A2-AE-3D-84-7E

or like this:

8E6530CDBE2F

Add the functionality to change the delimiter.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.