0

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!"
PAraf0x
  • 11
  • 2
  • Oh dear, it's getting worse! if you only use the less than symbol '<' then var_dump prints it, but why not in combination with letters? – PAraf0x Mar 01 '20 at 22:19
  • 3
    What's your PHP version? I can't reproduce this – iJamesPHP2 Mar 01 '20 at 22:29
  • 2
    cannot [reproduce](https://3v4l.org/E8Nil) – jibsteroos Mar 01 '20 at 22:56
  • I'm using the newest interpreter version 7.4.2 in combination with the Atom texteditor. I run my code on a webserver also with the newest version. I display the results vie Firefox – PAraf0x Mar 02 '20 at 16:13

1 Answers1

0

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.

Theder
  • 59
  • 4