also,
Quote: "if the function still gets called then would it not be less of an impact on performance to set it up like this and eliminate the call if the variable check is already a fail? "
Sorry, missed this bit.
Yes your assumption is correct! If performance matters, it is better to nest such expressions. Programmers can do this by placing the expression that is the least likely and least expensive to evaluate, on the outer most if / endif nests. Which is what you've done in example above.
A general rule (to anybody reading) is the function calling is more expensive (slower) than variable/array level operations.
It should be noted though, that such optimizations generally only make a significant performance improvement, when the cost of the expression is very high, the repetition level is very high or both.
So there's no need to rush out and stream line everything. Just where it matters!