[PHP-DEV] PHP5 extensions: using existing functionnames as method names

2006-09-13 Thread danhen
Hi, i just was wondering how existing function names could be used as method names in OO-Extensions for PHP5. I've looked through the SPL-source where this is done with functions like current() and next() in the iterators, but I couldn't find a hint how to do this. Can someone give me a little

Re: [PHP-DEV] PHP5 extensions: using existing function names as method names

2006-09-13 Thread danhen
...Just forgot to CC... >you can use any function name as method name without a clash. you just >cannot use language constructs that aren't real functions like >"empty", "echo" or "require" as method names. >this question better belongs to php-general, btw. Sorry if I didn't made myself clear eno

Re: [PHP-DEV] PHP5 extensions: using existing function names as method names

2006-09-13 Thread danhen
>It is possible to name a method like an existing function, I'm not sure >what you are doing exactly but it works here. I've tried: STRING_METHOD(String, trim) {...} (Yes, I'm trying to build a string class) that means that I also redefinied the Macros. Then I've changed the Macros from PHP_METH

Re: [PHP-DEV] PHP5 extensions: using existing functio nnames as method names

2006-09-13 Thread danhen
>Can you show some code? It will help to figure out >what's wrong. Yes I can :) stringclass.h #ifndef PHP_STRINGCLASS_H #define PHP_STRINGCLASS_H extern zend_module_entry string_module_entry; #define phpext_string_ptr &string_module_entry #ifdef PHP_WIN32 #define PHP_STRING_API __declspec(dll

Re: [PHP-DEV] PHP5 extensions: using existing function names as method

2006-09-13 Thread danhen
>Solution: Change "string_functions" to "NULL" in zend_module_entry. Thanks! You rescued my extension. Now I can finish and test the class. >> #define STRING_METHOD(function_name) \ >> ZEND_NAMED_FUNCTION(c_stringclass_##function_name) >> #define STRING_ME(name, arg_info, flags) \ >> ZE

Re: [PHP-DEV] PHP5 extensions: using existing function names as method

2006-09-13 Thread danhen
>primitive/common names is discouraged for non-core extensions >-Sara So what could be a proper naming convention for such classes? My Idea is: -PHPString -PHPInteger/PHPInt -... Any suggestion is welcome. Daniel -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: