RE: [PHP] question about ? :
| From: | Ford, Mike [LSS] | Date: | Mon, 17 Jun 2002 17:12:25 +0000 |
| Subject: | RE: [PHP] question about ? : | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-102797@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Lee Doolan [mailto:lee@affero.com]
> Sent: 14 June 2002 01:25
>
> >>>>> "Miguel" == Miguel Cruz <mnc@stoic.net> writes:
>
> Miguel> Why does this:
>
> Miguel> $x = 3 + 5 * 7;
>
> Miguel> produce different results from this:
>
> Miguel> $x = (3 + 5) * 7;
>
> Miguel> ?
>
> Miguel> miguel
>
> The two cases are not the same. In the case above, all operators are
> ternary --with equal precedence-- but in your case, the operators are
> of different precedence.
OK, try this: why does
$x = 3 + 5 - 7;
produce different results from
$x = 3 + (5 - 7);
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211