|
-
Sep 24th, 2004, 09:43 AM
#1
Thread Starter
Addicted Member
What Does This Code Do? [Resolved, Comments Welcome]
Code:
function compare($var1,$var2)
{
$string = "if($var1 $var2)
{
\$res=1;
}
else
{
\$res=0;
}";
eval("$string;");
return $res;
}
I'm trying to make sense of this code in this busted PHP application at work. Just to give you an idea, this function is usually called compare("foo", "==bar") . The quotes around the if blocks, the lack of a logic operator, the dereferencing of $res, the random eval(), I don't get it.
Last edited by Travis G; Sep 24th, 2004 at 10:39 AM.
Travis, Kung Foo Journeyman
Web Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.5 Guide and Reference
Perl: Documentation, Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
OSS: Mozilla, MySQL (Manual)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|