ID:               39808
 User updated by:  david at 1st-affiliation dot com
 Reported By:      david at 1st-affiliation dot com
 Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: fedora core 4
 PHP Version:      5.2.0
 New Comment:

tx for your reply

I found may be a answer in the commentary in this page :
http://www.php.net/manual/en/functions.arguments.php

But what is not clear is that php behave not like that since the 5.0
version at least.

So why changing an intelligent behavior by something less efficiant ?

This change will oblige to add conciderable coding and make the code
more heavy.

We have often functions where not all parameters are need. When there
is only one parameter it's simple, but more often there is several
optionals arguments, so the question is :

How to set arguments 4, and not 2 and 3 ? Because at the moment it's
not impossible to call a function without an argument (ie :
diner($starter,,$desert); is wrong, and diner($starter,null, $desert);
does not work fine)

So I invite the whole team to look after this behavior to find a better
way to use it.

Regards to all 

David


Previous Comments:
------------------------------------------------------------------------

[2006-12-12 21:00:49] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php



------------------------------------------------------------------------

[2006-12-12 20:52:21] david at 1st-affiliation dot com

Description:
------------
Hi

Since I upgrade the php version, the comportement of the function
default argument as change.

Previously, when I set a parameter to "null" the function use the
default value of the parameter. 

Now it kept the null value, and I do not find a another way to set the
default value.

See the code for more information

Reproduce code:
---------------
<?php
function eat ($what='apple') {
       print 'I eat '.$what;
}

eat(null);

?>

Expected result:
----------------
I eat apple

Actual result:
--------------
I eat 


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=39808&edit=1

Reply via email to