Re: Compare Values

From: Date: Sat, 26 Jun 2004 05:26:29 +0000
Subject: Re: Compare Values
References: 1  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-891@lists.php.net to get a copy of this message
* Thus wrote Frank Liebelt: > Hi > > First: This are my first steps with PECL. Please don't laugh about so simple > questions. (Hope this is the right list) I dont think anyone here is going to laugh, expecially with someone trying to learn something. > > I try to develop a WIN32 extension. Most of the functions work very well but > i don't know how to code the following. > > In my php script i call a function compareValues(); wich is in the > extension. First thing to note here. The function name compareValues() is probably not a good name to choose for your function. In traditional php usage, a name of the function should be prefixed with the name of the extension you are defining. For example, if your extension name is 'foobar' then your compare value function should be named: foobar_compare_value() Normally functions should be defined with a prefix of your extension followed by an underscore (_) followed by all word sperated with underscore as demonstrated above. See http://cvs.php.net/co.php/php-src/CODING_STANDARDS?r=1.32 for more information on standards. > The call looks like: > > $code = "47898729834928734779287349823"; > if (compareValues($code)) print "result is true"; > > The first 10 characters must be the same as the pre defined value within the > extension. > > I tried to read and understand the Zend API doc but the result is: 4 lines > of code: > > PHP_FUNCTION(comparevalues) > { > char **arg1; > } You might want to read the whole chapter 9 of the Zend API, it pretty much explains on how to accept paramaters from the php call. http://www.zend.com/apidoc/zend.arguments.php Your PHP_FUNCTON() logic will be something like: 1. parse out variables from php script. 2. evaluate what they passed. 3. return a value to the php script > The fix value looks like so: > char *FIXED(void) { return "4789872983"; ); > > I simply want to convert both values into a string to compare, but ever i > use > convert_to_string_ex() the apache server crashed. I've never developed an extension in windows, but I'm pretty sure thre are ways that you can trace excatly why you're program is crashing (null pointers, etc). Hopefully someone will be able to help in that area. Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid!

« previous php.pecl.dev (#891) next »