Fwd: Cannot get conditional statement to work
| From: | Adam | Date: | Sun, 12 Oct 2003 20:15:01 +0000 |
| Subject: | Fwd: Cannot get conditional statement to work | ||
| Groups: | php.smarty.dev | ||
| Request: | Send a blank email to php-smarty-dev+get-1899@lists.php.net to get a copy of this message | ||
All,
I apologize if this question is overly simplistic. I'm trying to write a conditional statement that I just cannot get to work. The statement reads:
(preg_match($strPattern, $strSource)) ? echo 'Match Found.' : echo 'No match.';
Each and every time I go to the page containing this statement I receive a parsing error with the message "unexpected T_ECHO".
If I rewrite the statement to read:
if (preg_match($strFilter, $strValue)) echo 'A match was found!'; else echo 'Not found!';
I have no issue. However, its really ticking me off that I cannot get it to work the first way. I am using PHP
Regards,
Adam
Platform versions: PHP 4.3.0, Apache 1.3, and Mac OS X 10.2.6