Replacing integers
Posted: Sun Jan 01, 2006 6:19 am
$SortBy is an integer
If I replace line 4 with then $Parameters is setting some other value for SortBy
Is this because $SortBy is an integer ? The first one is treated as a string because its concatenated with dot(.)s.
Thanks
Code: Select all
$Parameters = $_SERVER['QUERY_STRING'];
if (preg_match("/SortBy=([0-9]+)(&|$)/i", $Parameters, $matches) > 0)
{
$Parameters = str_replace($matches[0], "SortBy=".$SortBy.$matches[2], $Parameters);
}Code: Select all
$Parameters = str_replace($matches[1], $SortBy, $Parameters);Is this because $SortBy is an integer ? The first one is treated as a string because its concatenated with dot(.)s.
Thanks