hphp/runtime/ext/gd/ext_gd.cpp
static size_t php_strnlen(char* str, size_t maxlen) {
  size_t len = 0;

  if (str && maxlen && *str) {
    do {
      len++;
    } while (--maxlen && *(++str));
  }
  return len;
}
/* get length of string if buffer if less than buffer size or buffer size */
get length of string if buffer if less than buffer size or buffer size
get length of string if buffer if less than buffer size or buffer size
static size_t php_strnlen(char* str, size_t maxlen) {
  size_t len = 0;
  if (str && maxlen && *str) {
    do {
      len++;
    } while (--maxlen && *(++str));
  }
  return len;
}
static size_t php_strnlen ( char * str , size_t maxlen ) { size_t len = 0 ; if ( str && maxlen && * str ) { do { len ++ ; } while ( -- maxlen && * ( ++ str ) ) ; } return len ; }
get length of string if buffer if less than buffer size or buffer size
get length of string if buffer if less than buffer size or buffer size