I have this specific code that requires to be converted to preg_replace_callback however what it returns is the actual variable and not the value of the variable. Here is my code:
preg_replace:
$strValue = preg_replace("/(MYSQL_DATA::)([a-zA-Z0-9_]*)([^(::)]*)(::)/",
"\$rowData['\\2']", $this -> m_arrColumnValues[$key]);
here is the conversion to preg_replace_callback:
$strValue = preg_replace_callback("/(MYSQL_DATA::)([a-zA-Z0-9_]*)([^(::)]*)(::)/",
function ($matches) { return "\$rowData[$matches[2]]"; }, $this -> m_arrColumnValues[$key]);
Here is the output:
$rowData[fportTitle]
It is supposed to be from the result of this $rowData = mysqli_fetch_array($rsData)
but it displays the actual variable and not its supposed value.
Thank you in advance StackOverflow community.