|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2000-07-26 03:42 UTC] steeven at kali dot com dot cn
 here is a short sample program:
<?php
test();
function test($a1){
 echo "test";
}
?>
and an warning is shown:
Warning: Missing argument 1 for test() in e:\apache\htdocs\bbs\test1.php on line 3
test
There is no problem when I use php4.0.0, anyone have the same problem?
win98+apache+php4.0.1pl2
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 21:00:02 2025 UTC | 
If 4.0.0 didn't complain, then either it was broken or you had your error reporting level set differently. If you want a function to have an optional argument you have to set a default value. ie. function test($a1=0) { ... } Now you can call just test() without an argument.