Name: Anonymous 2009-07-22 10:22
Well, I make a student in web development, and my professor insists on using the longer version of things when writing PHP simply because he is used to it. Now, I have kind of gotten used to writing redundant code.
Here's an example of Me vs. My Professor:
Him
Me
Which way do you prefer writing it in?
Note
If you see any errors, please feel free to correct them.
Here's an example of Me vs. My Professor:
Him
if(!get_magic_quotes_gpc()) {
$username = addslashes($username);
}
$q = "select password from users where username = '$username'";
$result = mysql_query($q,$conn);
if(!$result || (mysql_numrows($result) < 1)){
return 1; //Indicates username failure
}Me
!get_magic_quotes_gpc() ? $username = addslashes($username) : TRUE;
$query = "SELECT password FROM users WHERE username = '$username'";
$result = mysql_query($query,$connection);
!$result || (mysql_num_rows($result) < 1) ? '1' : '2';Which way do you prefer writing it in?
Note
If you see any errors, please feel free to correct them.