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


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\[ \]

Updated on: 06-Apr-2020

332 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements