Reply to Re: I need a mini "logic interpreter"

Your name:

Reply:


Posted by Alan Little on 05/22/06 13:38

Carved in mystic runes upon the very living rock, the last words of
Baron Samedi of comp.lang.php make plain:

> $text = '2==2';
>
> eval('$condition = ($text)? true : false;');
>
> if ($condtion)
> echo '<hr>True<hr>';
> else
> echo '<hr>False<hr>';
>
>
> -----------------------------------------------------------------------
> False
> -----------------------------------------------------------------------

1) Variables in single quotes do not get evaluated. That expression
needs to be in double quotes, and then you need to escape the $
for $condition

2) You have a typo. You have $condition in your eval, and $condtion
in your if().

--
Alan Little
Phorm PHP Form Processor
http://www.phorm.com/

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация