Variable question regarding single quotion

Junior Spellweaver
Joined
Nov 15, 2009
Messages
106
Reaction score
1
This one is working:

Code:
$characters = "\s\-\'";

This one is not working:

Code:
$characters = '\s\-\'';

How do i make the one below working without using double quotations?
 
so this one $name = 'Bob'Bob';

how do so echo $name; outputs Bob'Bob and not only Bob?`

Option 1: Alternate quotes (") and ('). Works for simple strings with one type of quote when you don't want to escape ****.
Option 2: Just escape the (') (i.e. 'Bob'Bob' becomes 'Bob\'Bob'). This is normally what you should do.
 
Back