|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-09-29 09:11 UTC] php at nowhere dot net
[2004-09-29 22:01 UTC] helly@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 07 12:00:01 2025 UTC |
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