ebolt007 Posted May 7, 2010 Share Posted May 7, 2010 I'm getting a parse error on line 302: Parse error: syntax error, unexpected '[' in /home/bhharley/public_html/newsite2/calendar/admin.php on line 302 Line 302 is $day = getdatefromcalendarformat( $_REQUEST['dt'] )[2]; If I take out the [2] it works, but the calendar I'm working on breaks of course. How do I fix this? Link to comment https://forums.phpfreaks.com/topic/200968-parse-error-syntax-error-unexpected/ Share on other sites More sharing options...
Alex Posted May 7, 2010 Share Posted May 7, 2010 Unfortunately, you can't access members of an array returned from a function like that. $day = getdatefromcalendarformat( $_REQUEST['dt'] ); $day = $day[2]; Link to comment https://forums.phpfreaks.com/topic/200968-parse-error-syntax-error-unexpected/#findComment-1054416 Share on other sites More sharing options...
ebolt007 Posted May 7, 2010 Author Share Posted May 7, 2010 Great thanks, that fixed that but now I have one more error. Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/bhharley/public_html/newsite2/calendar/admin.php on line 575 here's the line $_REQUEST['dt'] = strtotime( $year."-".$month * 1."-".$day ); Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/200968-parse-error-syntax-error-unexpected/#findComment-1054418 Share on other sites More sharing options...
Alex Posted May 7, 2010 Share Posted May 7, 2010 If you wanted to do that you'd need to put the math inside of parenthesis: $_REQUEST['dt'] = strtotime( $year."-".($month * 1)."-".$day ); But what's the point of multiplying $month by 1 anyway? Link to comment https://forums.phpfreaks.com/topic/200968-parse-error-syntax-error-unexpected/#findComment-1054420 Share on other sites More sharing options...
ebolt007 Posted May 7, 2010 Author Share Posted May 7, 2010 Awesome thanks, that fixed it as well. Not sure why it's multiplying by one, I'm decoding it to figure that out. It's a calendar I downloaded and am trying to figure out, was just stuck on those 2 areas. Thanks a lot. Link to comment https://forums.phpfreaks.com/topic/200968-parse-error-syntax-error-unexpected/#findComment-1054422 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.