Norm
Norm

Reputation: 583

Why doesn't my browser print <Sat> on an HTML page?

I was trying to do sprintf("<%s>", "Sat");, but nothing comes out. When you remove the less than symbol, it will start working again. Anyone experience this behavior and whether it expected? as i think it is a bug.

You can even get the same result here with printf..... http://writecodeonline.com/php/

Upvotes: 2

Views: 301

Answers (2)

Mike B
Mike B

Reputation: 32155

Your browser is probably rendering it as a tag. View source to confirm.

http://codepad.org/g5FXZAwa

<?php

printf("<%s>", "Sat");

Prints <Sat>


Edit for Yogesh.

<?php

echo sprintf("<%s>", "Sat");

Prints <Sat>

Upvotes: 5

gd1
gd1

Reputation: 11403

I believe that this happens because <Sat> is interpreted by your browser as a tag.

Upvotes: 1

Related Questions