Re: [PHP-DEV] Get value if set, or default

2003-08-18 Thread Guy N. Hurst
Derick Rethans wrote: On Mon, 18 Aug 2003, Griggs Domler wrote: have come to the conclusion that a language statement, such as isset(), would be the best option. If you search the archives, you would have noticed that this was brought up before, and shot down. Derick Ok, I have spent hours

RE: [PHP-DEV] Get value if set, or default

2003-08-18 Thread Derick Rethans
On Mon, 18 Aug 2003, Griggs Domler wrote: > have come to the conclusion that a > language statement, such as isset(), would be the best option. If you search the archives, you would have noticed that this was brought up before, and shot down. Derick -- "Interpreting what the GPL actually mea

RE: [PHP-DEV] Get value if set, or default

2003-08-18 Thread Griggs Domler
: Guy N. Hurst Cc: Robert Cummings; [EMAIL PROTECTED] Subject: Re: [PHP-DEV] Get value if set, or default On Mon, 18 Aug 2003, Guy N. Hurst wrote: > Hi, > > The function Robert proposes only works for going one key deep. Can you please keep discussions to php-general@ please

Re: [PHP-DEV] Get value if set, or default

2003-08-18 Thread Derick Rethans
On Mon, 18 Aug 2003, Guy N. Hurst wrote: > Hi, > > The function Robert proposes only works for going one key deep. Can you please keep discussions to php-general@ please. Derick -- "Interpreting what the GPL actually means is a job best left to those that read the future b

Re: [PHP-DEV] Get value if set, or default

2003-08-18 Thread Guy N. Hurst
Hi, The function Robert proposes only works for going one key deep. That means one would have to specify getd($arr['sublevel'],$subkey), which would then create the key 'sublevel'. (That is assuming one has access to the parent keys) I have addressed this in the following function: function arr_

Re: [PHP-DEV] Get value if set, or default

2003-08-18 Thread Robert Cummings
Why not augment the userland function to the following: function getd( &$sourceArray, $key, $default=null ) { if( isset( $sourceArray[$key] ) ) { return $sourceArray[$key]; } return $default; } Cheers, Rob. On Mon, 2003-08-18 at 17:03, Griggs Domler wrote: > It's rare t

[PHP-DEV] Get value if set, or default

2003-08-18 Thread Griggs Domler
It's rare to find functionality that cannot be effectively implemented in userland PHP code, but this appears to be one of them. The issue here is the capability to check if an array index (or variable) is set, if so, return its value, or return a passed in default value. This can be accomplished