title: Is it safe to concatenate `null` with a string in PHP?
body: <p>I didn't found a statement about the compatibility between strings and <code>null</code> in the docs, but trying this on PHP 5.5:</p>
  
  <pre><code>echo 'foo' . null . 'bar';
  </code></pre>
  
  <p>prints out <code>foobar</code>.</p>
  
  <p>I wonder if this behaviour is guaranteed, or "safe" to do (in SQL, for example, it is not)? Or asking the other way: Would I ever need to check for <code>null</code> before concatenating strings? Like</p>
  
  <pre><code>echo 'foo' . (($mystring === null) ? '' : $mystring) . 'bar';
  </code></pre>