# Listings space -error

I get a strange symbol when i compile symbol on line 36 of this code:

I am not sure what you press to get that nice box where you can write the code. Please dont downvote me. Edit the post. I have tried to indet the code with 4 spaces but nothing seems to work. Sorry for the inconvinience.

\documentclass{article}
\usepackage{listings,xcolor}
\definecolor{dkgreen}{rgb}{0,.6,0}
\definecolor{dkblue}{rgb}{0,0,.6}
\definecolor{dkyellow}{cmyk}{0,0,.8,.3}

\lstset{
language        = php,
basicstyle      = \small\ttfamily,
keywordstyle    = \color{dkblue},
stringstyle     = \color{red},
identifierstyle = \color{dkgreen},
emph            =[1]{php},
emphstyle       =[1]\color{black},
emph            =[2]{if,and,or,else},
emphstyle       =[2]\color{dkyellow}}

\begin{document}
\begin{lstlisting}
<?php

$username =$_POST["username"];
$password =$_POST["password"];

$pass = md5($passwort);

// another comment
if($username=="User" and$pass=="123456")
{
echo "Welcome";
}
else
{
echo "Try again.";
}
?>
\end{lstlisting}
\end{document}


You are getting the blank spaces in strings. To eliminate them use showstringspaces=false (initially true) in the option.

\documentclass{article}
\usepackage{listings,xcolor}
\definecolor{dkgreen}{rgb}{0,.6,0}
\definecolor{dkblue}{rgb}{0,0,.6}
\definecolor{dkyellow}{cmyk}{0,0,.8,.3}

\lstset{
language        = php,
basicstyle      = \small\ttfamily,
keywordstyle    = \color{dkblue},
stringstyle     = \color{red},
identifierstyle = \color{dkgreen},
emph            =[1]{php},
emphstyle       =[1]\color{black},
emph            =[2]{if,and,or,else},
showstringspaces=false,                   %% <--- here
emphstyle       =[2]\color{dkyellow}}

\begin{document}
\begin{lstlisting}
<?php

$username =$_POST["username"];
$password =$_POST["password"];

$pass = md5($passwort);

// another comment
if($username=="User" and$pass=="123456")
{
echo "Welcome";
}
else
{
echo "Try again.";
}
?>
\end{lstlisting}
\end{document}


• Thank you! May I ask how you did to show the code in the box? – Rectifier Mar 19 '15 at 2:29
• @Rectifier Select the code and press {} button or cntrl + K. i.stack.imgur.com/jlBWI.png – user11232 Mar 19 '15 at 2:32
• @Rectifier Happy TeXing and nice time to you too. :) – user11232 Mar 19 '15 at 2:36