Quantcast
Channel: General developer forum
Viewing all articles
Browse latest Browse all 37677

Re: don't understand this evaluation

$
0
0
by Dan Poltawski.  

It's trying to avoid a database query by taking advantage of short-circuit execution. See http://php.net/manual/en/language.operators.logical.php

If is_mnet_remote_user returns false then the second half of the statement won't get executed because both sides can't possibly be true and the code needing $idprovider won't be called anyway.

See this example:

<?php
echo'Example:';
if(false and dosomething()){
    echo'Got into if statement';
}
echo'Done.';

function dosomething(){
    echo'Did Something.';
    returntrue;
}
 

Viewing all articles
Browse latest Browse all 37677

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>