if( $a == $b) { return true;} 
else { return false;}
how to write a ternary operater for the following ?
is this the way
if($a == $b)? return true; : return false开发者_运维知识库;
You don't need the ternary operator at all. Just return this and you'll get the correct true or false value.
return $a == $b;
You could just
return ($a == $b)
But if you really want to use the operator
return ( ($a == $b) ? true : false)
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论