I have a line with HTML attributes:
$attribs = ' id= "header " class = "foo bar" style ="background-color:#fff; color: red; "';
How to convert this string to an indexed array, for example:
array( 'id' => 'header', 'class' => array('foo', 'bar'), 'style' => array( 'background-color' => '#fff', 'color' => 'red' ) )
so I can use the array_merge_recursive PHP function to combine the two sets of HTML attributes.
thanks
html split php
abernier
source share