[UPHPU] Hierarchical Menu Ideas

Mac Newbold mac at macnewbold.com
Sat Dec 3 21:55:23 MST 2005


Today at 3:02pm, Mac Newbold said:

>>>> The resulting output is 4.  I would suggest using ($row[0] - 1) instead
>>>> of $row[0]-- when comparing values.
>> 
>> I believe $row[0]-- is the same as ($row[0] -1).  Both subtract 1 from 
>> $row[0].
>
> They both return the same value, but they don't both do the same thing. 
> ($row[0] - 1) is just an expression that is evaluated. $row[0]-- subtracts one 
> from $row[0] (saving the result in $row[0]) and then returns the new value of 
> $row[0]. In this case, it sounds like we don't want $row[0] to get modified, 
> so we want to use the one with the side effect: ($row[0] - 1)

Typo in that last line:

We want the one without the side effect: ($row[0] - 1)
 		    ^^^

Mac

--
Mac Newbold		MNE - Mac Newbold Enterprises, LLC
mac at macnewbold.com	http://www.macnewbold.com/


More information about the UPHPU mailing list