If you're a developer (you are reading this so you are) you've used jQuery to access different elements from a page.
It is super convenient to set data attributes to given HTML elements.
For example:
You can use jQuery to loop through all of the containers with 'app_container' class but how are you going to
tell which one you're currently processing? yes, you can use element's ID for that but if we want to put more data into that element we can achieve id using data attributes which can be accessed like so:
var id = $('app_container').prop('id');
var type = $('app_container').data('type');
Here is a PHP class that allows you to create HTML attributes from a php array.
If you pass the second parameter the key will be prefixed with 'data-' prefix so they can be access via jQuery later.