Re: [PHP-DEV] Re: Construct Request

2004-04-15 Thread Marcus Boerger
Hello Justin, Thursday, April 15, 2004, 5:28:29 PM, you wrote: >> echo setor($required_variable, die('error...'); >> or >> echo setor($error, ''); >> or >> echo setor($sMessage, $sDefaultMessage). >> or >> $z = setor($_GET['z'], 'Default'); >> $z = setor($_GET['z'], 'Default'); > Whats wrong wit

Re: [PHP-DEV] Re: Construct Request

2004-04-15 Thread George Schlossnagle
On Apr 15, 2004, at 3:35 PM, Timm Friebe wrote: On Thu, 2004-04-15 at 21:36, Chuck Hagenbuch wrote: Quoting Hartmut Holzgraefe <[EMAIL PROTECTED]>: [...] If this were added, wouldn't it make sense to use the convention already adopted by perl? $foo |= 'default'; Already used: $ php -r '$a= 1; $a

Re: [PHP-DEV] Re: Construct Request

2004-04-15 Thread Timm Friebe
On Thu, 2004-04-15 at 21:36, Chuck Hagenbuch wrote: > Quoting Hartmut Holzgraefe <[EMAIL PROTECTED]>: [...] > If this were added, wouldn't it make sense to use the convention > already adopted > by perl? > > $foo |= 'default'; Already used: $ php -r '$a= 1; $a |= 2; var_dump($a);' int(3) - Tim

Re: [PHP-DEV] Re: Construct Request

2004-04-15 Thread Chuck Hagenbuch
Quoting Hartmut Holzgraefe <[EMAIL PROTECTED]>: actualy in this special case i have been whishing for an operator for ages, maybe a modification of the good old ternary: $foo = ?$bar : "default"; or $foo ?= "default"; If this were added, wouldn't it make sense to use the convention alread

Re: [PHP-DEV] Re: Construct Request

2004-04-15 Thread Olivier Hill
Hartmut Holzgraefe wrote: or $foo ?= "default"; Looks Too Much Like Perl. IMO, if this is to be implemented, a function should be created, and not a set of operators. Olivier -- GB/E/IT d+ s+:+ a-- C++$ UL$ P L+++$ E- W++$ N- ?o ?K w--(---) !O M+$ V- PS+ PE- Y PGP t++ 5-- X+@ R- tv+

Re: [PHP-DEV] Re: Construct Request

2004-04-15 Thread Hartmut Holzgraefe
Justin Hannus wrote: Whats wrong with defining a user-level function? actualy in this special case i have been whishing for an operator for ages, maybe a modification of the good old ternary: $foo = ?$bar : "default"; or $foo ?= "default"; ;) -- Hartmut Holzgraefe <[EMAIL PROTECTED]> -- PH

Re: [PHP-DEV] Re: Construct Request

2004-04-15 Thread Justin Hannus
Actually, although suppressing the E_NOTICE, this is not exactly the behavior you want. What if $_GET['Does']['Not']['Exist'] really doesn't exists? It is then created and assigned to $param when passed as an argument to the param function. Therefore polluting $_GET with another unused array and a

Re: [PHP-DEV] Re: Construct Request

2004-04-15 Thread Todd Ruth
The thing I like about the suggestion over implementing the function in script is the ability to skip the call to a function that provides the default. In the following example, slowFunc() simulates a slow function using a sleep, but you can imagine any function call with a performance hit. The s

Re: [PHP-DEV] Re: Construct Request

2004-04-15 Thread Ferdinand Beyer
On 15 Apr 2004 at 11:47, Jason Garber wrote: > a. the actual variable in question could not be passed This is wrong, too. Look at this example: Output: array(2) { ["Exists"]=> string(1) "0" ["Does"]=> array(1) { ["Not"]=> array(1) {

Re: [PHP-DEV] Re: Construct Request

2004-04-15 Thread Derick Rethans
On Thu, 15 Apr 2004, Jason Garber wrote: > a. the actual variable in question could not be passed > b. it incurs the overhead of calling a user-level function Which takes about as much time as calling an internal function, so that argument is bogus. Derick -- PHP Internals - PHP Runtime Develo

[PHP-DEV] Re: Construct Request

2004-04-15 Thread Andrew
Hello, Thank you for your efforts for making PHP code error free and clean. Your idea to use common setor(arg1, arg2) function will completely resolve the problem of variable existing evaluating and further defaulting. By call of setor function developers will not take care about warnin

Re: [PHP-DEV] Re: Construct Request

2004-04-15 Thread Jason Garber
At 4/15/2004 11:28 AM -0400, Justin Hannus wrote: > echo setor($required_variable, die('error...'); > or > echo setor($error, ''); > or > echo setor($sMessage, $sDefaultMessage). > or > $z = setor($_GET['z'], 'Default'); > $z = setor($_GET['z'], 'Default'); Whats wrong with defining a user-level fu

[PHP-DEV] Re: Construct Request

2004-04-15 Thread Justin Hannus
> echo setor($required_variable, die('error...'); > or > echo setor($error, ''); > or > echo setor($sMessage, $sDefaultMessage). > or > $z = setor($_GET['z'], 'Default'); > $z = setor($_GET['z'], 'Default'); Whats wrong with defining a user-level function? function setor_array(&$array, $key, $def