title: How can I test whether a single character is lower case in PHP?
body: <p>I want to implement a small routine that generates the plural form of the name of an entity in Spanish. Basically, it takes a WordInCSharpCase or a wordInJavaCase, such as <code>MedioDePago</code> (payment method), and it appends an "s" at right before the first non-lowercase character (excluding the first character), which in this case would produce the string <code>MediosDePago</code> (payment methods). In C#, this routine was:</p>
  
  <pre><code>public string Pluralize(string input)
  {
      int i = 0;
      while (++i &lt; input.Length)
          if (!char.IsLower(input[i]))
              break;
  
      StringBuilder builder = new StringBuilder(input);
      builder.Insert(i, 's');
      return builder.ToString();
  }
  </code></pre>
  
  <p>Now I need to implement this routine in PHP, but I cannot find an equivalent of C#'s <code>char.IsLower</code>. The only thing I have found is <code>ctype_lower</code>, but it takes a <em>string</em> as an input, and creating/testing/discarding several strings would be too inefficient. Does PHP have a function that tests whether a single character is in lower case?</p>