Search code examples
phpstringatom-editorvar-dumpelementary-functions

PHP : No readable output, when I use the less than symbol, in combination with the var_dump() function


Why is in PHP this code snippet returning no readable output,

$string = "<Hello World!";
var_dump($string);

but this

$string = ">Hello World!";
var_dump($string);

is returning

">Hello World!"

Solution

  • It's seems that you dump this var in html file and browser parse this:

    "<Hello World!"
    

    as

    <hello world!"="" <="" body="">
    </hello>
    

    This snippet

    $string = ">Hello World!"
    

    can't be parsed as html tag, so you can get readable output.