Search code examples
phphtmlpropertiesmeta

Does the order of header properties matter?


Does the order of header properties matter in HTML and PHP?

In PHP, you can specify headers for a file like this:

header("Content-type: text/css; charset: UTF-8"). Can the order of Content-type and charset be swapped? Can Content-type have no capital C?

Another example might be initial-scale and width in HTML viewport meta tags. Can the order be swapped?

What will work and what won't? Why? Are these properties case sensitive? Can they be reordered?

EDIT: People are asking what reordered means in this case, for example....

Can Content-type and charset go the other way round in a header() function like header("charset: UTF-8; Content-type: text/css")

EDIT: It turns out that the PHP header tag does not work if you reorder the properties, but they are not case sensitive.


Solution

  • You can't reorder on PHP header tags, but you can on meta tags.

    They are not case sensitive.