|
Posted by Tim Roberts on 09/19/06 07:18
"comp.lang.php" <phillip.s.powell@gmail.com> wrote:
>
>[PHP]
> $array = array($firstOrderByFieldIfClause, $groupByClause,
>$orderByClause);
> array_walk($array, create_function('&$a', '$a = substr($a, 0,
>strrpos(trim($a), ",")); if ($a) $a = ", $a";'));
> print_r("firstOrderByFieldIfClause = $firstOrderByFieldIfClause and
>groupByClause = $groupByClause and orderByClause = $orderByClause<P>");
>[/PHP]
>
>Upon execution the fields within $array are never changed (verified by
>checking code), and I don't understand why.
It certainly does. Try "var_dump($array);", and you'll see that all three
strings were changed.
Your mistake is in thinking that changes to $array(0) will also affect
$firstOrderByFieldIfClause.
The array constructor makes three new strings.
--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
[Back to original message]
|