title: What types are automatically cast as string?
body: <p>I am using a third party logging library and there is a line where it runs <code>substr()</code> in a loop.  There is an <code>if (!is_array($value))</code> around it, but it seems like <code>$value</code> can wind up being pretty much any type of variable. A few weeks ago we had to put in a pull request to add <code>!is_object($value)</code> to the if statement because a different library was causing <code>$value</code> to be an object. And now we just ran into a situation where <code>$value</code> is a Resource.</p>
  
  <p>So I thought this exclusionary tactic may not be maintainable, why not just do:</p>
  
  <pre><code>if (is_string($value){ substr($value,0,3);...
  </code></pre>
  
  <p>That doesn't work, though, because sometimes <code>$value</code> is an <code>int</code> which <em>can</em> be used in <code>substr()</code> with no complaints.</p>
  
  <p>so is <code>if (is_string($value) || is_int($value) )</code> sufficient? How can I properly check if a variable is "stringable".</p>
  
  <p>Because this code is running inside the app, but logging things outside of the app, we really don't want it throwing exceptions that would not bring the app down otherwise, or hide the reason the app is failing</p>