Hello php-dev,

  Why & How this code will work?

  <?
   function foo($flag)
   {
      return $flag;
   }

   $a=TRUE;

   echo "if (!\$a = foo(FALSE))) is ";

   if (!$a = foo(FALSE))
     echo "true";
   else
     echo "false";

   echo "\n";
   var_dump($a);
   echo "\n";
  ?>
  
  Output:

  if (!$a = foo(FALSE))) is true
  bool(false)

  http://www.php.net/manual/en/language.operators.php "Operator Precedence"

  `!` has more precedence than `=`

  And after `!` we must have boolean constant in left side:

  FALSE = foo()

  Explain to me pls that I do not understand

  P.S. in C & Perl (!$a = foo()) is not valid expression

  

Best regards,
 Andrew Sitnikov                         
 e-mail : [EMAIL PROTECTED]
 GSM: (+372) 56491109


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to