Skip to content

Instantly share code, notes, and snippets.

@leocavalcante
Created September 27, 2020 17:08
Show Gist options
  • Save leocavalcante/b753038f655629fca3860febd288505a to your computer and use it in GitHub Desktop.
Save leocavalcante/b753038f655629fca3860febd288505a to your computer and use it in GitHub Desktop.
I know why you folks are so confused about this; it is because usually PHP is used on the web as some kind of HTML pre-processor, then you might think that every output on PHP is some HTML, but that is not quite right. Output is output like any other, just a piece of text, the PHP interpreter doesn't know and doesn't care what type of format you are outputting, for it it is just some text, that is why you can implement APIs that outputs some JSON or XML "instead". What your text might represent is NOT defined in the PHP interpreter when it is outputting something, that is why is wrong to say it is HTML, it is just some regular text, exactly like doing echo.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment