Hi,
I want to convert parts of a text string(text parts that are either between double-quotes or single-quotes) to variables(single-quotes) or constants(double-quotes).
The string is posted through a HTML form, an example below:
<?php
$iA = 1;
$iB = 10;
define('sA','binary');
$sText = "\'iA\' + \'iA\' = \'iB\' in \"sA\"";
// constants
$sText = preg_replace("/(\\")(\w+)(\\")",constant("//2"),$sText);
// variables
$sText = preg_replace("/(\\')(\w+)(\\')",${"//2"},$sText);
?>
I know how to isolate the parts,unfortunately anything I tried to convert parts in the text to either constant or variable caused a parse-error, or the result to be:
for this program I can't use eval()...unfortunately.
ne1?????
Thnx a lot in advance