Doesn't exactly work if your data ends with an array or an object - it trims ALL curly brackets from the end but it should only remove the last one. So, some ifs with some substr would actually be better.
But nice snippet nevertheless.
Upd.: It also need to trim spaces from extracted variable names. Like this for example:
Doesn't exactly work if your data ends with an array or an object - it trims ALL curly brackets from the end but it should only remove the last one. So, some
if
s with somesubstr
would actually be better.But nice snippet nevertheless.
Upd.: It also need to trim spaces from extracted variable names. Like this for example:
fn (\$variable) => str_replace('$', '', trim(\$variable, ' '))
Otherwise the spaces are kept as part of the keys breaking everything.
I've actually caught this bug a week ago and forgot to update the snippet! Good catch!