I want to create a map of lambda fns to clean up strings using regexes.
The keys will be group names.
I'm having an issue calling my test str on this lambda fn though.
$regex_fns = (object)[
'LINE_DATA' => function($str) { return preg_replace('/\s*/', '', $str); }
];
$my_key = 'LINE_DATA';
print($regex_fns->{$my_key}(' I am testing removing white space '));
There is also an example on http://sandbox.onlinephpfunctions.com/code/fd99947ff804cb056a91ffd9614a357abc7cb3bc.
Any ideas?