Re: beginner wants to add function
| From: | Andrei Zmievski | Date: | Thu, 07 Sep 2000 15:52:55 +0000 |
| Subject: | Re: beginner wants to add function | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-32570@lists.php.net to get a copy of this message | ||
On Thu, 07 Sep 2000, Pedro Garre wrote:
> Hi,
>
> I am sorry for this beginner's question, but I tried several faqs and
> knowledge databases and did not find the answer.
>
> I want to add a function to PHP:
> index_in_array ( $value, $array)
> which is similar to in_array but returning the index where $value is found
> or -1 if not found.
>
> First I wanted to check how difficult is to add a function, so I created a
> "brother" of in_array, named in_array_brother.
> For this I modified the files below:
> php_array.h => I added PHP_FUNCTION(in_array_brother);
> basic_functions.c => I added PHP_FE(in_array_brother)
> array.c => I copied the in_array stuff to in_array_brother (including the
> comments)
>
> That's all. Then: "make clean", "configure (with proper options)", and
> "make".
>
> "make" returns an error many lines below the in_array_brother function.
Check out array_keys() function. If provided with a second argument it
will return the keys where that value occurs.
-Andrei
* Proximity bug: when the code crashes in front of important visitors. *