答案1
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{listings}
\begin{document}
\begin{lstlisting}[language=PHP,breaklines,columns=flexible]
$a === $b;
\end{lstlisting}
\begin{lstlisting}[language=PHP,breaklines,basicstyle=\ttfamily]
$a === $b;
\end{lstlisting}
\end{document}
答案2
您可以滥用该literate
键来破坏连字符。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{listings}
\begin{document}
\begin{lstlisting}[language=PHP,breaklines]
$a === $b;
\end{lstlisting}
\begin{lstlisting}[language=PHP,breaklines,literate={===}{={}={}=}3] % <--- !
$a === $b;
\end{lstlisting}
\end{document}