Search code examples
phpquotesstring-concatenationdouble-quotes

learning about single and double quotes (.),("), and (')


Can you tell me what is the different using (')single quotes inside (")quotes and (")quotes inside (')single quotes? and at concat, what is the meaning of this '".$bla."' I still can not distinguish them.


Solution

  • In SQL, anything with single quotes is considered a text based data type.

    SQL uses double quotes for escaping keywords and non-ASCII characters.

    This:

    '". $bla ."'
    

    ..is PHP syntax. $bla is a PHP variable, the period is a string concatenation character (which is why there's one on both sides). So in this example, the content of the $bla variable is being concatenated into a string, where it will be surrounded by single quotes.