+ 13

HTML in a PHP code?

I know you can put HTML in a PHP code. My questions are: 1. why can you put HTML in a PHP code? 2. can you put HTML in any other coding language?

7th Jan 2021, 4:48 PM
Brain & Bones
Brain & Bones - avatar
10 Answers
+ 17
This method is especially useful if you have a lot of HTML code but want to also include PHP. As you can see, you can use any HTML you want without doing anything special or extra in your PHP file, as long as it's outside and separate from the PHP tags.
7th Jan 2021, 5:05 PM
ANMOL
ANMOL - avatar
+ 5
I think You can't put html in php You can put PHP in html
9th Jan 2021, 3:31 PM
Melekte Petros
Melekte Petros - avatar
+ 4
No only php.
7th Jan 2021, 4:52 PM
ŐŐžÖ†Ő«
+ 4
I'd say that depends. When using CGI, you can for example also use python to output html, simply by print-statements #!/usr/bin/python print "Content-type:text/html\r\n\r\n" print '<html>' print '<head>' print '<title>Hello World</title>' print '</head>' print '<body>' print '<h2>Hello World! </h2>' print '</body>' print '</html>' Here's a link in case you're interested in that topic: https://www.tutorialspoint.com/python/python_cgi_programming.htm
7th Jan 2021, 4:57 PM
Martin Ed
Martin Ed - avatar
+ 4
Php was designed that way.
7th Jan 2021, 9:29 PM
Sonic
Sonic - avatar
+ 4
React code includes JSX that also looks like HTML.
7th Jan 2021, 9:29 PM
Sonic
Sonic - avatar
+ 1
you can use html with php css javascript
8th Jan 2021, 8:01 AM
Yusuf M Hashmi