PDA

View Full Version : Parsing/Evaling to return true or false


Alcar Lazuli
03-20-2003, 04:45 AM
Say I had fields in a database that had:

$sysstat == 1
empty($sysmessage)
$sysyes < 1

How would I go about parsing/evaling the codes to return a true or false value depending on the field in the database?

So if $sysstat equaled 2, then obvisously $sysstat == 1 would return false.

How would I go about doing this?

Thankyou.

Xenon
03-20-2003, 11:15 AM
you just have to get em out of the db, whenever you use $blabl == blabla it will return true or false automatically

Alcar Lazuli
03-21-2003, 09:51 AM
Well, whenever I do parse it to a function for the actual processing, it always ends up turning out from:

"$blahblah == 1" to "$1". Everything returns "$1".

Alcar...

filburt1
03-21-2003, 10:55 AM
$1 isn't a legal variable name, how can anything return it?

Alcar Lazuli
03-21-2003, 08:36 PM
Today at 12:55 PM filburt1 said this in Post #4 (https://vborg.vbsupport.ru/showthread.php?postid=370572#post370572)
$1 isn't a legal variable name, how can anything return it?

Yes I understand that, but can you not use those variables in preg_replace() ?

I'm actually taking apart a piece of text using:

$text = preg_replace("#<if \((.+?)\)>(.+?)(<else>(.+?)</else>)</if>#is", xscondition('$1', '$2', '$3'), $text);

Now, I understand that the reason it is returning "$1" is because of the use of the single quotes, however I've tried most things, with trying to pass preg_replace() variables onto a function, and it just won't work.

Thankyou,
Alcar...