I do not want to display all the slashes when displaying the html
What I have is
echo "<input type=\"text\" name=\"myname\" value=\"myvalue\"";
What I want to do is:
echo '<input type="text" name="myname" value="myvalue">';
I am looking to save myself from typing all the slashes. Is there a way around that?
Your second example works (although it is ugly), I assume you want a way to be able to print variables while printing the HTML with double quotes. If that’s the case, you could use Heredoc syntax:
Or, better, yet, you could use a templating system (which PHP kind of is) or a MVC framework to separate your business and presentational logic so you don’t have to go around printing stuff like input fields in the first place. 🙂