HTML to PHP Converter

Form for HTML converting

This form allows you convert HTML to PHP code for using via echo or print statements:


Your result can be seen below.

Result of HTML conversion to PHP code


Move to "Paste Code" for Save it

About HTML conversion to PHP Code

About HTML conversion to PHP

The HTML to PHP Converter was created for online converting HTML into PHP code. This can come in handy for print HTML code via PHP print functions, used in most PHP CMS and frameworks, such as WordPress, Yii, Laravel, etc. Quote and backslash characters will be appropriately escaped with backslashes so the strings will print correctly.

How it Works?

Just paste your HTML code to the textarea above and click to the button "Convert" and you will get PHP echo or print statements in the next textarea.

Example of HTML conversion to PHP

Before:
<html>
    <head>
    <title>Your Title Here</title>
    </head>

    <body bgcolor="FFFFFF">
        <center><img src="wtools.jpg" align="bottom"> </center>
        <hr>
        <a href="http://wtools.io">Best Online Web Tools</a>is a link to another nifty site
        <h1>This is a Header</h1>
        <h2>This is a Medium Header</h2>
        Send me mail at <a href="mailto:[email protected]">[email protected]</a>.
        <p> This is a new paragraph!</p>
        <p> <b>This is a new paragraph!</b></p>
        <br> <b><i>This is a new sentence without a paragraph break, in bold italics.</i></b>
        <hr>
    </body>
</html>
After:
<?php
echo '<html>
    <head>
    <title>Your Title Here</title>
    </head>

    <body bgcolor="FFFFFF">
        <center><img src="wtools.jpg" align="bottom"> </center>
        <hr>
        <a href="http://wtools.io">Best Online Web Tools</a>is a link to another nifty site
        <h1>This is a Header</h1>
        <h2>This is a Medium Header</h2>
        Send me mail at <a href="mailto:[email protected]">[email protected]</a>.
        <p> This is a new paragraph!</p>
        <p> <b>This is a new paragraph!</b></p>
        <br> <b><i>This is a new sentence without a paragraph break, in bold italics.</i></b>
        <hr>
    </body>
</html>';
Or:
<?php
echo '<html>';
echo '<head>';
echo '<title>Your Title Here</title>';
echo '</head>';
echo '';
echo '<body bgcolor="FFFFFF">';
echo '<center><img src="wtools.jpg" align="bottom"> </center>';
echo '<hr>';
echo '<a href="http://wtools.io">Best Online Web Tools</a>is a link to another nifty site';
echo '<h1>This is a Header</h1>';
echo '<h2>This is a Medium Header</h2>';
echo 'Send me mail at <a href="mailto:[email protected]">[email protected]</a>.';
echo '<p> This is a new paragraph!</p>';
echo '<p> <b>This is a new paragraph!</b></p>';
echo '<br> <b><i>This is a new sentence without a paragraph break, in bold italics.</i></b>';
echo '<hr>';
echo '</body>';
echo '</html>';
After the conversion, you can apply the PHP Code to your project or use it for some other purpose.
Donate

Did you like this tool? You can donate to us. This will help us improve our free web tools.

Paypal