echo $smart;
colors-is-red-or-pink-or-blue-or-tortoise/form-is-elliptical-or-rectangular/material-is-plastic
$colors = array('red', 'pink', 'blue', 'tortoise');
$form = array('elliptical', 'rectangular');
$material = array('plastic');
$smart = 'colors-is-red-or-pink-or-blue-or-tortoise/form-is-elliptical-or-rectangular/material-is-plastic';
$defs = [];
foreach(explode('/', $smart) as $part) {
$def = explode('-is-', $part);
$defs[$def[0]] = explode('-or-', $def[1]);
}
print_r($defs);
[
"colors" => ["red", "pink", "blue", "tortoise"],
"form" => ["elliptical", "rectangular"],
"material" => ["plastic"]
]
$data = array_reduce(explode('/', $str), function($acc, $n) {
list($key, $values) = explode('-is-', $n);
$acc[$key] = explode('-or-', $values);
return $acc;
}, []);