bundyxc Posted August 5, 2009 Share Posted August 5, 2009 I see this a lot: $con = mysql_connect($setHostname,$setUsername,$setPassword); if (!$con) { die (mysql_error()); } But is there any reason not to just do this? if (!$con = mysql_connect($setHostname,$setUsername,$setPassword)) { die (mysql_error()); } It seems like everybody freaks out over typing an extra five characters.. is there a reason not to just do the second example? Link to comment https://forums.phpfreaks.com/topic/168924-shortcuts/ Share on other sites More sharing options...
trq Posted August 5, 2009 Share Posted August 5, 2009 Both pieces of code do exactly the same thing. Link to comment https://forums.phpfreaks.com/topic/168924-shortcuts/#findComment-891261 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.