4 ms·
This is how I would approach such an issue with php. This assumes it would be run through eval or written to file and included. Obviously to make this valid php
by shaunxcode 18y ago
This is how I would approach such an issue with php. This assumes it would be run through eval or written to file and included. Obviously to make this valid php I would replace { with Array( and } with ) -- but I decided to stick to the spec above for arguments sake.
$parsed = str_replace('{', '{"', '{'.str_replace(Array('[', ']'), Array('" => {', ''), $string)) .str_repeat('}', substr_count($string, '[')+1);
- eru 18y agoKeep away from small children and tainted data.
- shaunxcode 18y agothe truth is spoken here.