I need to escape a string that has a lot of " and '. The string is a binary from a database. I have this:
$String64 = '<a data-String64="'.$binary64.'">Link</a>';
So the $binary64
has some text like target:"29", width=100'height=200...
So my problem is that the "'
are closing the data-String64
before it can output the entire variable. I have tried addslashs(), but nothing good.
How can I escape this?
This is what I have tried:
$String64 = "<a data-string64='${binary64}'><b><i class='fa fa-eye'></i></b></a>";
$String64 = "<a data-string64='{$binary64}'><b><i class='fa fa-eye'></i></b></a>";
$String64 = "<a data-string64=\'${binary64}\'><b><i class='fa fa-eye'></i></b></a>";
$String64 = "<a data-string64=\'$binary64\'><b><i class='fa fa-eye'></i></b></a>";
$String64 = "<a data-string64=\"$binary64\"><b><i class=\"fa fa-eye\"></i></b></a>";