$args in an if()

This does what I want:
[php]if($form_lname == strtolower ($lastname) AND $form_fname == strtolower ($firstname)) {
echo ‘

  • ’. $user->display_name . ‘
  • ’;
    }[/php]

    But this does not:
    [php]$args=’$form_lname == strtolower ($lastname) AND $form_fname == strtolower ($firstname)’;
    if($args) {
    echo ‘

  • ’. $user->display_name . ‘
  • ’;
    }[/php]

    Wat am I missing?

    Thanks,
    Tim

    Doesn’t work like that in conditional statements… your ‘if’ is basically saying “if this is a string, do something” instead of evaluating the contents of the string, and will always evaluate to TRUE.

    Make sense?

    Just as a simpler example:

    [php]
    $x = 3;
    $args = “$x > 5”;

    if ($args) {
    echo $x . ’ is greater’;
    } else {
    echo $x . ’ is less’;
    }

    //output: 3 is greater

    [/php]

    Sponsor our Newsletter | Privacy Policy | Terms of Service