$fail_row = mysql_fetch_array($sql_fail_check);
$tries = $time_row['tries'];
I was reading that it saves memory to do thing inline/less lines. Since i am only going to need the tries count from that MySql array only, could i make this be just one line somehow?
Forget that piece of advice – it is utter, complete nonsense.Re your update: The advice you quote is suggesting compressing
into
this makes sense for very large amounts of data, because the step of storing the value in a variable (
$description) doubles the amount of memory needed to storedescription, which could lead memory limit problems.In your case however,
There is no elegant way to directly address an element from an array coming from a function call (like
$tries = mysql_fetch_array($sql_fail_check)["tries"];) – it’s syntactically not possible.triesis probably never going to be large enough for this optimization to make any difference.Remember: Optimize only when necessary, or if you know that you are going to be dealign with really significant amounts of data. Unless this is the case, code readability always comes first.