- rtrim: documentation ( source)
- var_export: documentation ( source)
- preg_split: documentation ( source)
<?php
$input = 'color=blue,red,weight=100kg,another=one,two,three,four,okay=enough,';
var_export(preg_split('~,(?=[^,]+=)~', rtrim($input, ','), 0, PREG_SPLIT_NO_EMPTY));