Just browsing over the latest release of the PHP coding standards, and something caught my eye:
http://svn.php.net/viewvc/php/php-src/trunk/CODING_STANDARDS?revision
To get the length of a string zval (variable in C) use Z_STRLEN(your_zval) see zend_operators.h at line 398 (PHP 5.4) :
#define Z_STRLEN(zval) (zval).value.str.len