A basic, and unalterable rule, in American and Canadian English, is that a comma and a period ALWAYS go inside the quotation marks. ALWAYS. But then, there are always exceptions. If the period would confuse the matter, then it goes outside. For example, if you were writing "to end this command, hit 'E'" then you would put a period outside the quotes. More wisely, you would recast the sentence to say, "to end this command, hit the 'E' key."
Now, the British say that the "full stop" (as they call it) and the comma go OUTSIDE the quote marks if that punctuation was NOT included in the quotation. The problem is, they forget the "if" part of that rule. They tend to always put it outside, regardless of whether the quotation included a full stop, or not. This is plain wrong, but then, "they invented it" so we have to tolerate their idiosyncrasies.
In America/Canada, if the full quote was:
I love you.
Then in those countries you would say, "I heard him say, 'I love you.'"
In British English (including NZ and AUS), you will find
"I heard him say, 'I love you'."
Bizarre, but true.
Now, as for the double quotes:
The American/Cdn usage is to use a double quote first, with interior quote as single, and one inside that as double again, etc.
The Brits will start with the single quote mark, then move to double quotes, then single, etc.
I think this is all a part of proving what Mark Twain said: that we are "two great nations divided by a common language."
Student or Learner