Hi everyone!
I'd like to ask a simple question to which I can't really find a definitive answer. If I condense my code a lot, will this mean an increase in loading times which is significant enough?
I like having my code spaced out, readable, but I would also like a faster site. For example, if I turn this code into the one below it it will be about a third of the site. I think one is 487 bytes, the other 182bytes.
<?php
// Start Session
session_start();
// Check if there is a session already or if the time has run out
if ( (!empty $_SESSION[user]) OR ($_SESSION[user][time] < time()) )
// If this is the case, destroy the session and redirect to sign up page
{
$_SESSION = array();
header('Location: [SIGN IN URL]');
exit();
}
// If the session is ok, then prolong it for another ten minutes
else
$_SESSION[user][time] = time() + 600;
?>
<?php session_start();if((!empty $_SESSION[user])OR($_SESSION[user][time]<time())){$_SESSION = array();header('Location: [SIGN IN URL]');exit();}else $_SESSION[user][time]=time() + 600;?>
The two are the same, but all line breaks and spaces taken out. Do you think this will result in a speed increase? Since most of the php code is processed on the server side, the answer is not as obvious to me as if it was html code.
Thanks in advance!