Re: Re[2]: [PHP] equivalent to perl shift function

From: Date: Thu, 01 May 2008 08:12:00 +0000
Subject: Re: Re[2]: [PHP] equivalent to perl shift function
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-273759@lists.php.net to get a copy of this message
2008/5/1 Richard Luckhurst <rluckhurst@resmaster.com>: > Hi Chris, > > In perl ther is the concept of @_ which is the list of incoming parameter to a > subroutine. It is possible to have something like > > my $sock = shift; > > As I understand this the first parameter of the @_ list would be shifted. > > I see for array_shift there must be an argument, the array name to shift, while > in perl if the array name is omitted the @_ function list is used. Is ther a php > equivalent to the @_ list or how might I use array_shift to achieve the same > result as in perl? I''ve no idea why you want to handle arguments in the same way as perl does - but func_get_args() returns the array of arguments to the function and you can shift that with array_shift() if you like. http://www.php.net/manual/en/function.func-get-args.php -robin

« previous php.general (#273759) next »