|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-07-10 14:25 UTC] derick@php.net
[2004-07-10 20:30 UTC] markem at ev1 dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 18:00:01 2025 UTC |
Description: ------------ File #1: ################################################################################ # HTML Library ################################################################################ # Begin Table ################################################################################ function tb( $alignA, $bgPicA, $bgColorA, $borderA, $borderColorA, $cellPaddingA, $cellSpacingA, $columnsA, $heightA, $widthA ) { $theReply = "<table "; if( isset($alignA) )$theReply .= "align='$alignA' "; if( isset($bgPicA) )$theReply .= "background='$bgPicA' "; if( isset($bgColorA) )$theReply .= "bgcolor='$bgColorA' "; if( isset($borderA) )$theReply .= "border='$borderA' "; if( isset($borderColorA) )$theReply .= "bordercolor='$borderColorA' "; if( isset($cellPaddingA) )$theReply .= "cellpadding='$cellPaddingA' "; if( isset($cellSpacingA) )$theReply .= "cellspacing='$cellSpacingA' "; if( isset($columnsA) )$theReply .= "columns='$columnsA' "; if( isset($heightA) )$theReply .= "height='$heightA' "; if( isset($widthA) )$theReply .= "width='$widthA' "; $theReply .= ">"; return $theReply; } File #2: (test program) <?php include "html.php"; $theLine = ""; $theLine .= tb( null,null,"#FFFFFF"); echo "$theLine\n"; ?> Running the above generates: C:\apache\lib>php test.php Content-type: text/html X-Powered-By: PHP/4.3.1 PHP Warning: Missing argument 4 for tb() in c:\apache\lib\html.php on line 7 PHP Warning: Missing argument 5 for tb() in c:\apache\lib\html.php on line 7 PHP Warning: Missing argument 6 for tb() in c:\apache\lib\html.php on line 8 PHP Warning: Missing argument 7 for tb() in c:\apache\lib\html.php on line 8 PHP Warning: Missing argument 8 for tb() in c:\apache\lib\html.php on line 8 PHP Warning: Missing argument 9 for tb() in c:\apache\lib\html.php on line 8 PHP Warning: Missing argument 10 for tb() in c:\apache\lib\html.php on line 8 <table bgcolor='#FFFFFF' ><tr ><td ></td></tr></table> Expected result: ---------------- 1. If not having to pass arguments to a function (variable call arguments) is normal, then why does PHP generate a warning about missing arguments? 2. If variable call arguments are possible - why can you not call the function in this manner: $theLine .= tb(,,"#ffffff"); ??????? PHP should treat the empty ",," as two nulls. Instead, an error is generated by PHP and PHP dies.