Re: default function argument issue

From: Alvaro G Vicario (alvaro_QUITAR_REMOVE_at_telecomputeronline.com)
Date: 03/23/04


Date: Tue, 23 Mar 2004 17:36:52 +0100


*** Brad Kent wrote/escribió (23 Mar 2004 08:16:53 -0800):
> array() is a constant

Actually, it's a language construct. A constant would be something like
M_PI. But you are right, your code works.

I hadn't tested your original code. I've done it now and it works fine for
me, just correcting a typo —you define test() and call foo()—:

This:

        function test($foo=array()) {
                echo gettype($foo);
                implode(' ',$foo);
        }

        test();

prints:

        array

-- 
-- 
-- Álvaro G. Vicario - Burgos, Spain
--


Relevant Pages

  • Re: array() VS Array()
    ... The lowercase notation, ... function- and language construct names might be removed from future PHP ... versions and 'array' is the preferred notation. ...
    (comp.lang.php)
  • Need opposite of array()
    ... Looking for a language construct or function that gives the opposite of ... array so can be passed as arg list to sprintf and similar functions. ... first element of $argsarray, but looking for something cleaner and more ...
    (comp.lang.php)
  • Re: How do I pass an array key from a multi-dimensional array to a new array?
    ... Chris wrote: ... RTFM on the "foreach" language construct. ... foreach ($array as $key=>$value) is not the solution. ...
    (comp.lang.php)
  • Re: default function argument issue
    ... >> array() is a constant ... > Actually, it's a language construct. ... > I hadn't tested your original code. ... just correcting a typo —you define testand call foo—: ...
    (comp.lang.php)