misleading error message
am 13.01.2008 04:56:14 von Peter PeiTry the following to see it
class A {
}
function foo(A $a = 1) {
;
}
foo();
?>
Try the following to see it
class A {
}
function foo(A $a = 1) {
;
}
foo();
?>
am using .2.5
On 13 Jan., 04:56, "Peter Pei"
> Try the following to see it
>
> =A0class A {
> =A0}
> =A0function foo(A $a =3D 1) {
> =A0 ;
> =A0}
> =A0foo();
> ?>
I get this, which isn't missleading:
>>>
Fatal error: Default value for parameters with a class type hint can
only be NULL in /Applications/MAMP/htdocs/compile/includes/
CParser.inc.php on line 12
<<<
On 13 Jan., 05:01, seaside
> On 13 Jan., 04:56, "Peter Pei"
>
> > Try the following to see it
> >
> > =A0class A {
> > =A0}
> > =A0function foo(A $a =3D 1) {
> > =A0 ;
> > =A0}
> > =A0foo();
> > ?>
>
> I get this, which isn't missleading:
. since you can't pass anything else.
On 13 Jan., 05:01, seaside
> On 13 Jan., 04:56, "Peter Pei"
>
> > Try the following to see it
> >
> > =A0class A {
> > =A0}
> > =A0function foo(A $a =3D 1) {
> > =A0 ;
> > =A0}
> > =A0foo();
> > ?>
>
> I get this, which isn't missleading:
.. since you can't define any other default value [sorry, typo in my
previous posting]
Peter Pei wrote:
> Try the following to see it
>
> class A {
> }
> function foo(A $a = 1) {
> ;
> }
> foo();
> ?>
>
So, what is your error? I'm not necessarily running the same version as
you.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
right, my screen cut off part of the msg ;-)
On Jan 12, 7:56 pm, "Peter Pei"
> Try the following to see it
>
> class A {
> }
> function foo(A $a = 1) {
> ;
> }
> foo();
> ?>
i dont see code like this before, try the following.. hope this will
help.. :P
class A {
var $val;
function A($value)
{
$this->val = $val;
}
}
function foo(new A(1))
{
print $a->val
}
foo();
?>
On Jan 13, 12:16 am, "radmissio...@gmail.com"
wrote:
> On Jan 12, 7:56 pm, "Peter Pei"
>
> > Try the following to see it
> >
> > class A {
> > }
> > function foo(A $a = 1) {
> > ;
> > }
> > foo();
> > ?>
>
> i dont see code like this before, try the following.. hope this will
> help.. :P
>
>
> class A {
> var $val;
> function A($value)
> {
> $this->val = $val;
>
> }
> }
>
> function foo(new A(1))
> {
> print $a->val
>
> }
>
> foo();
> ?>
im not familiar with the versions.. :P