mtorbin Posted June 30, 2009 Share Posted June 30, 2009 I held off on posting this until I was absolutely sure I did as much research on my own as I could. I'm sure I'm missing something SUPER simple but I'm not sure what it is. The following code snippet: <?php function setEventVars() { $tempOBJ = new object(); $tempOBJ.myGameID = "something"; $tempOBJ.myHomeTeamName = "something"; $tempOBJ.myHomeTeamCity = "something"; $tempOBJ.myVisitTeamName = "something"; $tempOBJ.myVisitTeamCity = "something"; $tempOBJ.myGameDate = "something"; $tempOBJ.myGameTime = "something"; $tempOBJ.myVenueID = "something"; $tempOBJ.myPerfID = "something"; $tempOBJ.myGenre = "something"; return $tempOBJ } ?> gives me the following error message: Parse error: syntax error, unexpected '=' in .../sandbox.php on line 4 And for the life of me I cannot figure out why. What am I doing wrong? - MT Quote Link to comment https://forums.phpfreaks.com/topic/164275-solved-correctly-assigning-attributes-to-an-object/ Share on other sites More sharing options...
Mark Baker Posted June 30, 2009 Share Posted June 30, 2009 $tempOBJ->myGameID = "something"; Quote Link to comment https://forums.phpfreaks.com/topic/164275-solved-correctly-assigning-attributes-to-an-object/#findComment-866572 Share on other sites More sharing options...
mtorbin Posted June 30, 2009 Author Share Posted June 30, 2009 $tempOBJ->myGameID = "something"; Mark, thank you! I knew it was something simple. Quote Link to comment https://forums.phpfreaks.com/topic/164275-solved-correctly-assigning-attributes-to-an-object/#findComment-866575 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.