AW: [PECL-DEV] Compare Values
| From: | Frank Liebelt | Date: | Sat, 26 Jun 2004 16:47:24 +0000 |
| Subject: | AW: [PECL-DEV] Compare Values | ||
| References: | 1 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-892@lists.php.net to get a copy of this message | ||
Hi
> I dont think anyone here is going to laugh, expecially with someone
> trying to learn something.
Thanks
> 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 read the doc but that what i want would'nt work.
Here is what i have now:
(Don't care about the function name. I will i rename if it worked)
PHP_FUNCTION(checkval)
{
zval **parameter;
char *key = NULL;
key = "6575736883";
/* argument count is correct, now retrieve arguments */
if((ZEND_NUM_ARGS() != 1) || (zend_get_parameters_ex(1, ¶meter)
!= SUCCESS))
{
WRONG_PARAM_COUNT;
}
convert_to_string_ex(parameter);
RETURN_STRING(*parameter,0);
}
This is for testing only. I send the parameter from the php script like
this:
echo checkval("65757368837485728368818481837172906871837778837274");
Normally im awaiting a printout of :
65757368837485728368818481837172906871837778837274
But in my Browser i allways see such crypt character : à22 which is
changing after every reload.
This isnt my real problem.
But this her is:
How can i compare the first 10 characters from the given value with the
defined key?
I dont want other to do my work but a sample function that does my needs
would be fine.
So i could learn from that.
Thanks in advance
Frank
____________
Virus checked by Antivirus-Profi-Paket
Version: AVK 14.0.1217 from 19.06.2004
Virus news: www.antiviruslab.com