This is a discussion on "Valid php syntax" within the PHP Forum section. This forum, and the thread "Valid php syntax are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Valid php syntax
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
Valid php syntax
Hi, Is this valid syntax?? If I set $postcode to 1111 it still comes back false..
Nathan. |
|
|
|
#2
|
|||
|
|||
|
Re: Valid php syntax
It's valid syntax, but incorrect logic. You can't have a number that's both less than 2000 and greater than 2599, so the first half will never be true. You can't have a number less than 2620 and greater than 2898, so the second half will never be true either.
I think you mean if ($postcode < 2000 || ($postcode > 2599 && $postcode < 2620) || $postcode < 2898) { $error = "Out of state"; } |
|
#3
|
|||
|
|||
|
Re: Valid php syntax
oops... of course... I feel silly now!!!
Thanks!! |
![]() |
| Tags |
| valid php syntax |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| valid html+css for google | dab42pat | Search Engine Optimization (SEO) | 11 | Feb 17th, 2008 01:40 |
| Using a valid Doctype | Wesley | Web Page Design | 46 | Jan 16th, 2008 17:02 |
| Designing + XHTML/CSS Valid. | PicoDeath | Job Opportunities | 0 | Oct 29th, 2007 10:16 |
| Valid Coding | ThePerfectCrime | Free Web Site Critique | 23 | Jul 27th, 2007 17:01 |
| is onbeforeunload xhtml valid | karloff | Web Page Design | 8 | Jul 25th, 2006 13:15 |