title: Do all php types return a bool?
body: <p>I'm currently building a website and I come across the case where I can do:</p>
  
  <p><code>if (myString)</code></p>
  
  <p><code>if (myArray)</code>,</p>
  
  <p>and it seems to "return" true whenever there is data inside the variable. At least, that's what I think.</p>
  
  <p>E.g.</p>
  
  <pre><code>$testVar = "test";
  if ($testVar)
      echo $testVar;
  else
      echo "Empty";
  </code></pre>
  
  <p>When i assert <code>$testVar = ""</code>, then it echos "Empty".</p>
  
  <p>I'm wondering if this is a defined feature of PHP, that any type will return true if it is not null or empty, as in other languages you need to do <code>if($testVar = "")</code> or so on.</p>
  
  <p>Additionally, if this does indeed return true on all types if the variable is not empty, and I also want to check if the variable exists, would:</p>
  
  <p><code>if (isset($testVar) &amp;&amp; $testVar)</code> be okay to use (in terms of practices)</p>
  
  <p>I have searched for questions but can't find an answer to this exact question. To summarize:<br>
  Can any type return a bool, provided that it is not empty?</p>
  
  <p>Thanks.</p>