企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
### 7.7.3 类型转换 ```c //将原类型转为特定类型,会更改原来的值 ZEND_API void ZEND_FASTCALL convert_to_long(zval *op); ZEND_API void ZEND_FASTCALL convert_to_double(zval *op); ZEND_API void ZEND_FASTCALL convert_to_long_base(zval *op, int base); ZEND_API void ZEND_FASTCALL convert_to_null(zval *op); ZEND_API void ZEND_FASTCALL convert_to_boolean(zval *op); ZEND_API void ZEND_FASTCALL convert_to_array(zval *op); ZEND_API void ZEND_FASTCALL convert_to_object(zval *op); #define convert_to_cstring(op) if (Z_TYPE_P(op) != IS_STRING) { _convert_to_cstring((op) ZEND_FILE_LINE_CC); } #define convert_to_string(op) if (Z_TYPE_P(op) != IS_STRING) { _convert_to_string((op) ZEND_FILE_LINE_CC); } //获取格式化为long的值,不会更改原来的值,op类型为zval*,返回值为zend_long #define zval_get_long(op) _zval_get_long((op)) //获取格式化为double的值,返回值double #define zval_get_double(op) _zval_get_double((op)) //获取格式化为string的值,返回值zend_string * #define zval_get_string(op) _zval_get_string((op)) //字符串转整形 ZEND_API int ZEND_FASTCALL zend_atoi(const char *str, int str_len); ZEND_API zend_long ZEND_FASTCALL zend_atol(const char *str, int str_len); //判断是否为true #define zval_is_true(op) \ zend_is_true(op) ```