On 06/06/16 13:10, Andrea Faulds wrote:
> 
> However, we already have solutions for both of these in PHP. PHP's
> functions and methods can have optional parameters for which you do not
> have to provide an argument, and because PHP is dynamically-typed, a
> parameter can accept an argument of any type (and within the function
> body discriminate between types) if it needs to. Also, PHP has fewer and
> more generalised types than some other languages do, so where a C#
> method might have overloaded versions taking a UInt8, UInt16, UInt32,
> SInt8, SInt16 and so on, an equivalent PHP method might only take PHP's
> single universal integer type.

This used the be the reason PHP worked so well ... one did NOT have to
worry about how a parameter was provided, and even today one is *NOT*
providing a binary 'int' even if you 'type' the value to be such. The
whole point of a compiled language being able to provide several
versions of the same function but with different binary parameter sizes
and types is hopefully something that will never trouble PHP? PHP is not
building a binary parameter stack for the function call.

function foo($a) {} is still the natural way of doing things if the
FIRST validation step is '$a between 1 and 10' and adding the 'int' does
nothing to change the work flow of handling $a in my book ... just loads
the process with additional checks which often have to be duplicated
internally anyway to maintain a proper flow through the process.

-- 
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to