fixes function_exists performance issue.
Fixes CRM_Utils_Array::value performance issue.
fixes function_exists performance issue.
fixes function_exists performance issue.
fixes str_replace performance issue.
fixes #12200 , backport cache code for performance reason