How to make this backwards compatible with PHP5.2? It works on 5.3 and later
error
Fatal error: Cannot call method self::utf8_dec() or method does not exist
code
private function utf8_decode($arr){
array_walk_recursive($arr, 'self::utf8_dec'); // <----- error
return $arr;
}
private function utf8_dec(&$value, $key){
$value = utf8_decode($value);
}
Instead of
self, you can use the name of the class directly. It’s not as flexible but it should work.Also you need to prefix the methods with the
statickeyword.