Re: [PHP] Using function prototypes in code

2011-08-10 Thread Tim Streater
On 10 Aug 2011 at 02:10, Frank Thynne frank.thy...@gmail.com wrote: In the interest of clarity and maintainability I would like to be able to write code that makes it clear what kind of arguments a function expects and what it returns. So add the appropriate comments to your functions.

Re: [PHP] Using function prototypes in code

2011-08-10 Thread David Harkness
On Tue, Aug 9, 2011 at 6:10 PM, Frank Thynne frank.thy...@gmail.com wrote: function integer int_func(string $s) { // does something like, say, converting five to 5 } As Stuart pointed out, type-hinting currently only works for classes and arrays. Scalar type-hinting is planned for the

Re: [PHP] Using function prototypes in code

2011-08-10 Thread Simon J Welsh
On 10/08/2011, at 1:10 PM, Frank Thynne wrote: To confuse me a bit further, I can't find a definitive list of the basic type names. For example, is it integer or int? Both. http://php.net/manual/en/language.types.type-juggling.php#language.types.typecasting --- Simon Welsh Admin of

[PHP] Using function prototypes in code

2011-08-09 Thread Frank Thynne
In the interest of clarity and maintainability I would like to be able to write code that makes it clear what kind of arguments a function expects and what it returns. This is what I tried: function integer int_func(string $s) { // does something like, say, converting five to 5 } There are

Re: [PHP] Using function prototypes in code

2011-08-09 Thread Stuart Dallas
On 10 Aug 2011, at 02:10, Frank Thynne wrote: In the interest of clarity and maintainability I would like to be able to write code that makes it clear what kind of arguments a function expects and what it returns. This is what I tried: function integer int_func(string $s) { // does