MrCreeky Posted January 20, 2009 Share Posted January 20, 2009 Hi, Today I have started getting this error: Notice: Use of undefined constant void - assumed 'void' Line of code: <?php $day = ($row_rs1_events['ddate']); // Day of the countdown $month = ($row_rs1_events['mdate']); // Month of the countdown $year = ($row_rs1_events['ydate']); // Year of the countdown $hour = 24; // Hour of the day (east coast time) $event = ($row_rs1_events['name']); //event $calculation = ((mktime ($hour,0,0,$month,$day,$year) - time(void))/3600); $hours = (int)$calculation; $days = (int)($hours/24); ?> and this one: Notice: Undefined index: loginid in Line of code: <div class="login_div" id="login_div"><form action="index.php" method="get" enctype="multipart/form-data" name="login" class="login_form" id="login_form"> <span class="login_text">Login ID</span> <input name="loginid" type="text" size="10" /></form></div> What would make that just start to happen? Windows Server 2003, PHP 5.2.8 http://www.hifisquad.com/test.php Link to comment https://forums.phpfreaks.com/topic/141667-solved-use-of-undefined-constant-void-assumed-void/ Share on other sites More sharing options...
revraz Posted January 20, 2009 Share Posted January 20, 2009 Does it work ok if you remove void? Link to comment https://forums.phpfreaks.com/topic/141667-solved-use-of-undefined-constant-void-assumed-void/#findComment-741575 Share on other sites More sharing options...
trq Posted January 20, 2009 Share Posted January 20, 2009 time does not eccept any arguments, you have misread the manual. Link to comment https://forums.phpfreaks.com/topic/141667-solved-use-of-undefined-constant-void-assumed-void/#findComment-741579 Share on other sites More sharing options...
MrCreeky Posted January 20, 2009 Author Share Posted January 20, 2009 That's odd. Removing it worked but why would it have only just started to show this error on my part? Link to comment https://forums.phpfreaks.com/topic/141667-solved-use-of-undefined-constant-void-assumed-void/#findComment-741584 Share on other sites More sharing options...
DarkWater Posted January 20, 2009 Share Posted January 20, 2009 Why were you passing a string literal containing 'void' into time()? Link to comment https://forums.phpfreaks.com/topic/141667-solved-use-of-undefined-constant-void-assumed-void/#findComment-741588 Share on other sites More sharing options...
MrCreeky Posted January 20, 2009 Author Share Posted January 20, 2009 Because I guess I'm not so good at coding Link to comment https://forums.phpfreaks.com/topic/141667-solved-use-of-undefined-constant-void-assumed-void/#findComment-741600 Share on other sites More sharing options...
revraz Posted January 20, 2009 Share Posted January 20, 2009 Some sites show (void) as a optional parameter. Link to comment https://forums.phpfreaks.com/topic/141667-solved-use-of-undefined-constant-void-assumed-void/#findComment-741601 Share on other sites More sharing options...
trq Posted January 20, 2009 Share Posted January 20, 2009 Some sites show (void) as a optional parameter. Like the manual you mean? The meaning of the word void.... Containing nothing; empty; vacant; not occupied; not filled. Some people need to read a manual about reading manuals. Optional arguments are surrounded by [] brackets. Removing it worked but why would it have only just started to show this error on my part? Maybe your error_reporting level has changed? Link to comment https://forums.phpfreaks.com/topic/141667-solved-use-of-undefined-constant-void-assumed-void/#findComment-741605 Share on other sites More sharing options...
revraz Posted January 20, 2009 Share Posted January 20, 2009 And some people need to not assume... http://www.w3schools.com/PHP/func_date_time.asp Some sites show (void) as a optional parameter. Like the manual you mean? The meaning of the word void.... Containing nothing; empty; vacant; not occupied; not filled. Some people need to read a manual about reading manuals. Optional arguments are surrounded by [] brackets. Link to comment https://forums.phpfreaks.com/topic/141667-solved-use-of-undefined-constant-void-assumed-void/#findComment-741614 Share on other sites More sharing options...
trq Posted January 20, 2009 Share Posted January 20, 2009 And some people need to not assume... http://www.w3schools.com/PHP/func_date_time.asp Some sites show (void) as a optional parameter. Like the manual you mean? The meaning of the word void.... Containing nothing; empty; vacant; not occupied; not filled. Some people need to read a manual about reading manuals. Optional arguments are surrounded by [] brackets. Thats what you get reading an unreliable source. Whoever wrote that also cannot read the manual. Link to comment https://forums.phpfreaks.com/topic/141667-solved-use-of-undefined-constant-void-assumed-void/#findComment-741615 Share on other sites More sharing options...
DarkWater Posted January 20, 2009 Share Posted January 20, 2009 Traditionally, 'void', when used in function headers, means that nothing gets passed in. Not sure why it says "optional" next to it on W3schools. Regardless, the PHP manual is the best source to rely on for these function prototypes. Link to comment https://forums.phpfreaks.com/topic/141667-solved-use-of-undefined-constant-void-assumed-void/#findComment-741617 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.