PHP and backslashes in strings
问题 Can anyone tell me what is happening here? <?php // true var_dump('\\ ' === '\ '); // false var_dump('\\\\ ' === '\\ '); // true var_dump('\\\\ ' === '\\\ '); 回答1: \ inside a string literal introduces several types of escape sequences, \\ is the escape sequence for a literal "\". But, \ s that don't resolve to an escape sequence are also taken as literal "\". Therefor, '\\ ' stands for the string "\ ", '\\\\ ' stands for the string "\\ ", just as '\\\ ' . Try: echo '\\\\ '; -> \\ See http:/