PHP: is there a way to see “invisible” characters like \n

PHPServer Side ProgrammingProgramming

The addcslashes function can be used. Below is the syntax of the function −

string addcslashes ( string $str, string $charlist )

This function returns a string with backslashes that appear before the characters. Below is a demonstration of the function.

Example

 Live Demo

<?php
   echo addcslashes('sample[ ]', 'A..z');
?>

Output

This will produce the following output −

\s\a\m\p\l\e\[ \]
raja
Published on 06-Apr-2020 12:05:43
Advertisements