I need to convert a PHP array into HTML tag attributes, with spaces and quotes, this is an example:
$array=array(
'attr1'=>'value1',
'id'=>'example',
'name'=>'john',
'class'=>'normal'
);
This is the result I need to achieve:
attr1="value1" id="example" name="john" class="normal"
There is any PHP function to do it?
I am trying these:
- http_build_query
- array_walk