ID: 24570 Updated by: [EMAIL PROTECTED] Reported By: da_bomb at hisplace dot net -Status: Open +Status: Wont fix Bug Type: Feature/Change Request Operating System: * PHP Version: 5.*
Previous Comments: ------------------------------------------------------------------------ [2004-09-29 22:01:03] [EMAIL PROTECTED] At the moment the parser/compiler/executor trio doesn't allow this at all. Before we can suppport this we'd need major changes all over the engine becuase the current situation is that we allways have two opcodes for every parameter. Allowing other things as default parameters would break this rule.... ------------------------------------------------------------------------ [2004-09-29 09:11:16] php at nowhere dot net This probably shouldnt be supported in the engine. I'm not aware of any languages where this is supported. If you want a default value, then use the existing capability to set it withing the scope of the function. ------------------------------------------------------------------------ [2003-07-09 18:05:44] da_bomb at hisplace dot net Description: ------------ Hey, I've shown a function I'm trying to write that is giving me an error because I can set an object as a default function parameter. I don't know if this is a bug, or it wasn't intended to be possible but I reckon it would be a good addition. I can't see a specific reason not to have this functionality unless it runs into some issues such as namespaces did. Thanks :) Reproduce code: --------------- public function PadLeft ( Int32 $var1, Char $var2 = new Char ( ' ' ) ) { // line 315 try { $this->Value = str_pad($this->Value, $var1->Value, $var2->ToString(), STR_PAD_LEFT); return( true ); } catch ( xException $ex ) { return( $ex->False ); } } Expected result: ---------------- I wasn't expecting to see the error anyway :p I'd like to have the result I'm looking for returned if possible. Actual result: -------------- Parse error: parse error, unexpected T_NEW in D:\www\root\objects\TMP2ct7ths5f1.php on line 315 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=24570&edit=1