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

[email protected] ("Robin Vickery")
Newsgroups php.general
Message-ID <[email protected]>
2008/5/1 Richard Luckhurst <[email protected]>:
> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.