Here is a part of a bigger script:
function parse_template($parse_target){
global $language_arr;
$parse_data = array(
"/[b](.?)[\/b]/" => "<b>\1</b>", // bold
"/[i](.?)[\/i]/" => "<i>\1</i>", // italic
"/[u](.?)[\/u]/" => "<u>\1</u>", // underline
"/[langstring id=(.?)]/" => $language_arr["\1"] );
return preg_replace(array_keys($parse_data),array_values($parse_data),$parse_target);
}
The problematic line is this one:
"/[langstring id=(.*?)]/" => $language_arr["\1"]
It is "supposed" to show the whatever variable from the array, but instead it just does:
Notice: Undefined index: \1 in C:\Program Files\Apache Group\Apache2\htdocs\include\templates.php on line 30
If you call the variable seperately (out of the preg thingie) it works fine. Any way to implement the thing I want?
P.S
If you can, please help with a short efficient working alternative for the language array