PHP: switch() default for all?
<p>I have this:</p>

<pre><code>case true:

    echo '&lt;textarea rows="2" cols="35" name="message_friend" id="message_friend"&gt;&lt;/textarea&gt;';
    break;

    default:
    echo '&lt;textarea rows="2" cols="35" name="message_friend" id="message_friend" readonly="readonly"&gt;&lt;/textarea&gt;';
    break;
</code></pre>

<p>I am trying to ONLY if it's true, then show normal else do READONLY.</p>

<p>The switch is checking from a function</p>

<pre><code>switch( ( check_friend_state($showU["id"], 'friend') ) )
</code></pre>

<p>And I tried to echo the function, and it returned err2 and not true, so why does it run true?</p>

<p>I also tried if/else</p>

<pre><code>if(check_friend_state($showU["id"], 'friend') == true){

echo '&lt;textarea rows="2" cols="35" name="message_friend" id="message_friend"&gt;&lt;/textarea&gt;';
}else{
echo '&lt;textarea rows="2" cols="35" name="message_friend" id="message_friend" readonly="readonly"&gt;&lt;/textarea&gt;';
}
</code></pre>

<p>But as said previously it returns "err2" and still it runs true?</p>

<p>My function at the return:</p>

<pre><code>if($USER == $uID){ // not yourself
return "err1";
}elseif( $checkIsFriend-&gt;rowCount() == 1 ){  // already friends
return "err2";
}elseif( $checkAlready-&gt;rowCount() == 1 ){ // already send a request
return "err3";
}elseif( $checkBlock-&gt;rowCount() == 1 ){ // blocked
return "err4";
}else{
return true;
}
</code></pre>
