Re: [PECL-DEV] Publishing new extension on pecl.php.net
[email protected] (Antony Dovgal) Sat, 22 May 2010 13:17:56 +0400
| Newsgroups | php.pecl.dev |
|---|---|
| Message-ID | <[email protected]> |
After looking some more.. what is the reason to implement this as a C extension?
The code below looks simple enough for me, no complex calculations, hash lookups etc.
Simple enough to be implemented in PHP itself, I mean.
function get_triangle_simple_squre($side_a, $altitude_a) {
if ($side_a <= 0 || $altitude_a <= 0) {
trigger_error(E_WARNING, "...");
}
return ($side_a * $altitude_a) / 2;
}
On 22.05.2010 09:08, Марк Крейн wrote:
> ===========
> PHP_FUNCTION(get_triangle_simple_square)
> {
> double side_a, altitude_a;
> double result;
> if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &side_a, &altitude_a) == FAILURE)
> {
> return;
> }
>
> if (side_a <= 0 || altitude_a <= 0)
> {
> zend_error(E_WARNING, ERROR_SIZE);
> }
>
> result = (side_a * altitude_a) / 2;
> RETURN_DOUBLE(result);
> }
--
Wbr,
Antony Dovgal
---
http://pinba.org - realtime statistics for PHP