<p>There is a small difference, single-quoted strings don't support interpolation:</p>

<pre><code>{% set string = 'There is a #{car}.' %}
</code></pre>

<p>The above example <strong>won't</strong> work. If you want to use it, you need to wrap your string in double quotes:</p>

<pre><code>{% set string = "There is a #{car}." %}
</code></pre>

CC BY-SA 3.0
2014-06-25T15:06:08.840Z
@Bryan `{{ 'test' ~ 'String' }}` works for me.
carlcs
CC BY-SA 3.0
2014-06-25T15:14:48.627Z
@ChristianSeelbach Yep. You're right. I misread the Twig docs.
Bryan Redeagle
CC BY-SA 3.0
2014-06-16T22:16:13.100Z
This is similar to the PHP logic between single and double quotes.
Lindsey D
CC BY-SA 3.0
2014-06-17T11:22:58.837Z
Except that you can concatenate string in PHP using single quotes (using "."). Twig still requires double quotes (using "~").
Bryan Redeagle
CC BY-SA 3.0
2014-06-16T21:25:53.340Z
2014-06-17T09:50:36.137Z
2014-06-17T09:50:36.137Z
nicael
<p>Is there a difference between using single-quoted and double-quoted strings?</p>

<templating><string><difference>
What's the difference between using single and double quotes in strings?
# What's the difference between using single and double quotes in strings?

(Asked by: username_0 on 2014-06-16)

Is there a difference between using single-quoted and double-quoted strings?

**Tags:** templating, string, difference

---

## 1 answers

### Answer by username_0 on 2014-06-16. Score: 18 | Accepted answer

There is a small difference, single-quoted strings don't support interpolation:
{% set string = 'There is a #{car}.' %}

The above example won't work. If you want to use it, you need to wrap your string in double quotes:
{% set string = "There is a #{car}." %}

> **Comments:**
> **username_3**: This is similar to the PHP logic between single and double quotes.  
> **username_2**: Except that you can concatenate string in PHP using single quotes (using "."). Twig still requires double quotes (using "~").  
> **username_1**: @Bryan `{{ 'test' ~ 'String' }}` works for me.  
> **username_2**: @ChristianSeelbach Yep. You're right. I misread the Twig docs.  

---

