How to replace or filter bad words from text like str_ireplace? I need replace the word from key to value in array but without use foreach and explode.
Example array
$_filter = [
'badwords' => [
'one' => 'time',
'bad' => 'good',
'ugly' => 'beauty'
]
];
Example replace
$before = 'anyone help me please';
$after = 'anytime help me please';
$before = 'I need BaD function';
$after = 'I need good function';
$before = 'I am so (ugly)';
$after = 'I am so (beauty)';
trying these but not working. Anyone can help me please. Thank you