ID: 24570 Comment by: php at nowhere dot net Reported By: da_bomb at hisplace dot net Status: Open Bug Type: Feature/Change Request Operating System: WinXP Pro PHP Version: 5CVS-2003-07-09 (dev) New Comment:
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. Previous Comments: ------------------------------------------------------------------------ [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