Re: Publishing new extension on pecl.php.net

From: Date: Sat, 22 May 2010 09:17:56 +0000
Subject: Re: Publishing new extension on pecl.php.net
References: 1  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-7237@lists.php.net to get a copy of this message
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

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